group by and one column per month? - Mailing list pgsql-novice

From Harald Lux
Subject group by and one column per month?
Date
Msg-id 3C586F67.29034.255827@localhost
Whole thread Raw
Responses Re: group by and one column per month?
List pgsql-novice
given a table with these fields:

dealer char()
revenue float()
vdate date

now:

select dealer, sum(revenue)
    from table
group by dealer

and also:

select dealer, sum(revenue)
    from table where date_part('month', vdate) = 1
group by dealer

work fine.

But instead of one column with the whole revenue (first example) or the renvenue of one month
(second example) I would like to have a column for each month. is this possible within one select
statement?

TIA
Harald
--
Harald Lux                      lux@lux.de
Sandkaule 5-7                   Tel.: +49 228 692325
D-53111 Bonn                    http://www.lux.de/


pgsql-novice by date:

Previous
From: "postgresql"
Date:
Subject: Re: ^[[A
Next
From: Torbjörn Andersson
Date:
Subject: Re: group by and one column per month?