From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
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 15:55:48 |
Message-ID: | 20020507085247.G71502-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 7 May 2002, Marco Kienzle wrote:
> The following problem occur using the sum() function (see the attached
> file for all the details and an example):
> - if you use it on a portion of a table (example: table age) you get a
> result that differ from the one you can get by hand (see the whole table
> temp1 and do the sum by hand)
> - if you use the sum() function on the complete table (i.e. if you
> first create a temporary table and then run the sum() function) then you
> get the right result (see example on temp1).
Well, since you didn't give data on age, I can't tell for certain, but
your temp table is not necessarily the same as the source. With that
group by I believe you're dropping duplicates if there are any. I'd
suggest seeing what (untested sql)
select inst,year,month,lengthcell,sex,age,agenum,weightmeanage,count(*)
from age where weightmeanage>0 and lengthcell=160 group by inst,
year,month,lengthcell,sex,age,agenum,weightmeanage having count(*)>1;
gives you.
From | Date | Subject | |
---|---|---|---|
Next Message | Tatsuo Ishii | 2002-05-08 03:09:47 | Re: Bug #659: lower()/upper() bug on ->multibyte<- DB |
Previous Message | pgsql-bugs | 2002-05-07 14:51:12 | Bug #659: lower()/upper() bug on ->multibyte<- DB |