Re: [SQL] Problem with pivot tables

2011-11-06 Thread Samuel Gendler
On Sun, Nov 6, 2011 at 9:06 AM, Gabriel Filipiak wrote: > I have problem with creating a pivot table in postgreSQL using crosstab > function. It works well but it produces many records for the same > client_id, how can I avoid it? > > Here is the SQL: > > SELECT * FROM crosstab('SELECT client_id,

[SQL] Problem with pivot tables

2011-11-06 Thread Gabriel Filipiak
I have problem with creating a pivot table in postgreSQL using crosstab function. It works well but it produces many records for the same client_id, how can I avoid it? Here is the SQL: SELECT * FROM crosstab('SELECT client_id,extract(year from date), sum(amount) from orders group by extract( ye