Re: sum(field) as total group with a where condition... - Mailing list pgsql-general

From dave@hawk-systems.com (Dave)
Subject Re: sum(field) as total group with a where condition...
Date
Msg-id DBEIKNMKGOBGNDHAAKGNKEEEIGAA.dave@hawk-systems.com
Whole thread Raw
In response to Re: sum(field) as total group with a where condition...  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List 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 by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: sum(field) as total group with a where condition...
Next
From: Mike Withers
Date:
Subject: User Input - Multiple Parameters