From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Marco Kienzle <m(dot)kienzle(at)marlab(dot)ac(dot)uk> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: problem with the sum function |
Date: | 2002-05-07 14:37:56 |
Message-ID: | 23443.1020782276@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Marco Kienzle <m(dot)kienzle(at)marlab(dot)ac(dot)uk> writes:
> herring=3D# select sum(agenum) from age where weightmeanage>0 and lengthcel=
> l=3D160;
> sum=20
> -----
> 77
> (1 row)
> select INTO TABLE temp1 inst, year, month, lengthcell, sex, age, agenum, w=
> eightmeanage from age where weightmeanage>0 and lengthcell=3D160 group by i=
> nst, year, month, lengthcell, sex,age,agenum, weightmeanage;
> herring=3D# select sum(agenum) from temp1;
> sum=20
> -----
> 73
> (1 row)
Why would you expect these to give the same result? The "group by"
effectively eliminates duplicate rows, thus removing some contributions
to the sum.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | pgsql-bugs | 2002-05-07 14:51:12 | Bug #659: lower()/upper() bug on ->multibyte<- DB |
Previous Message | Dmitry Tkach | 2002-05-07 14:23:08 | Re: problem with the sum function |