Search Postgresql Archives

How to convert rows into HTML columns?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux