Re: [SQL] select with group by problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] select with group by problem
Дата
Msg-id 8222.945450564@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [SQL] select with group by problem  (<kaiq@realtyideas.com>)
Список pgsql-sql
<kaiq@realtyideas.com> writes:
> because there is a sum. sum always results something, even
> the something's value is a null ;-)

Yeah, but in GROUP BY mode, that SUM() should return one row per group.
If no input, then there are no groups, so there should be no output.
This is in fact a bug in Postgres: it produces a row anyway, which is
right for the un-GROUPed case but not when GROUPing.

The bug is fixed for the next release.  In the meantime you might want
to use a workaround like adding "HAVING COUNT(*) > 0" to the query.
        regards, tom lane


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

Предыдущее
От: neko@kredit.sth.szif.hu
Дата:
Сообщение: Re: [SQL] select with group by problem
Следующее
От: kaf@ip146.usw5.rb1.bel.nwlink.com (Kyle)
Дата:
Сообщение: simple sql select help