Re: How to convert rows into HTML columns? - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: How to convert rows into HTML columns?
Date
Msg-id 6D36D064-897D-4E0A-A55B-57DCAEFA95CB@seespotcode.net
Whole thread Raw
In response to How to convert rows into HTML columns?  (Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>)
List pgsql-general
On Oct 5, 2007, at 1:20 , Stefan Schwarzer wrote:

> Before I was used that the yearly values were all to be found in a
> single SQL row; now for each year of each country I have a separate
> row. How do I convert that into a single (HTML) row again?

Take a look at the crosstab functions in contrib/tablefunc.

> And the next question coming up is: How should my query look like
> so that I can sort the (HTML) table by a specific year in ascending
> or descending order? So, that it doesn't display it by the country
> names alphabetical order, but by, say 1998?

Same way you would otherwise -- ORDER BY -- after using crosstab.

Michael Glaesemann
grzm seespotcode net



pgsql-general by date:

Previous
From: Stefan Schwarzer
Date:
Subject: Re: Find min year and min value
Next
From: Michael Glaesemann
Date:
Subject: Re: Find min year and min value