Re: problem with the sum function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: problem with the sum function
Дата
Msg-id 23443.1020782276@sss.pgh.pa.us
обсуждение исходный текст
Ответ на problem with the sum function  (Marco Kienzle <m.kienzle@marlab.ac.uk>)
Список pgsql-bugs
Marco Kienzle <m.kienzle@marlab.ac.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Dmitry Tkach
Дата:
Сообщение: Re: problem with the sum function
Следующее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #659: lower()/upper() bug on ->multibyte<- DB