How to convert rows into HTML columns?
От | Stefan Schwarzer |
---|---|
Тема | How to convert rows into HTML columns? |
Дата | |
Msg-id | E01BB01F-53D7-4877-8952-E13EC00297EE@grid.unep.ch обсуждение исходный текст |
Ответы |
Re: How to convert rows into HTML columns?
Re: How to convert rows into HTML columns? |
Список | pgsql-general |
Hi there, I feel like a brain-washed person being slowly re-socialized. After changing from an Excel-like database design to a "central table" one (see here: http://archives.postgresql.org/pgsql-general/2007-10/ msg00132.php ) I am struggling with multiple problems... One is now the HTML table display of a simple SELECT : SELECT d.year, d.value, c.name AS country_name FROM public_one_table.data AS d LEFT JOIN countries AS c ON c.id = id_country WHERE id_variable = 1644 AND (year = '2000' OR year = '1999' OR year = '1998') ORDER BY country_name ASC 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? 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? Thanks for any help! Stef
В списке pgsql-general по дате отправления: