Re: sum(field) as total group with a where condition...

Поиск
Список
Период
Сортировка
От dave@hawk-systems.com (Dave)
Тема Re: sum(field) as total group with a where condition...
Дата
Msg-id DBEIKNMKGOBGNDHAAKGNKEEEIGAA.dave@hawk-systems.com
обсуждение исходный текст
Ответ на Re: sum(field) as total group with a where condition...  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
>> and want it to find all those that match a particular date (field2),
>then return
>> sums for each field1...  using the above table should generate the following
>> result for field2=12345
>
>select
>    field1,field2,sum(field3) as total
>from
>    table
>where
>    field2=12345
>group by
>    field1, field2
>;

forgot to group by both fields that were not in the sum function...
beautiful...  thanks to those who responded.

Dave


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: sum(field) as total group with a where condition...
Следующее
От: Mike Withers
Дата:
Сообщение: User Input - Multiple Parameters