Reproducing a question asked some time ago but this time using PostgreSQL:
I have a table that looks like this:
Month Site Val
2009-12 Microsoft 10
2009-11 Microsoft 12
2009-10 Microsoft 13
2009-12 Google 20
2009-11 Google 21
2009-10 Google 22
And I want to get a 2-dimension table that gives me the "Val" for each site's month, like:
Month Microsoft Google
2009-12 10 20
2009-11 12 21
2009-10 13 22
In my case the "Site" column has hundreds of values, which makes it very tedious to explicitly state their names and types (all are the same type) in crosstab function.
Any idea of how to do it in PostgreSQL?