The generic way of doing cross tabs (sometimes called PIVOT queries) in an ANSI-SQL database such as PostgreSQL is to use CASE statements which we have documented in the article What is a crosstab query and how do you create one using a relational database?
In this particular issue, we will introduce creating crosstab queries using PostgreSQL tablefunc contrib.
Link Posted by Tim at December 25, 2007 01:09 PM | TrackBack