PostgreSQL Crosstab Query

Posted by schone on Stack Overflow See other posts from Stack Overflow or by schone
Published on 2010-06-09T01:13:03Z Indexed on 2010/06/09 1:22 UTC
Read the original article Hit count: 489

Filed under:
|
|

Hi all,

Does any one know how to create crosstab queries in PostgreSQL?

For example I have the following table:

Section    Status    Count
A          Active    1
A          Inactive  2
B          Active    4
B          Inactive  5

I would like the query to return the following crosstab:

Section    Active    Inactive
A          1         2
B          4         5

Is this possible?

Thanks!

© Stack Overflow or respective owner

Related posts about sql

Related posts about postgresql