Search Postgresql Archives

tablefunc and crosstab

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

 



Hi !

I am trying to use crosstab function from tablefunc.

SELECT * from crosstab('select date, source, name, value FROM cth ORDER by
1', 'select distinct name from cth order by 1') AS ct(date timestamp,
source text, val1 text, val2 text, val3 text, val4 text, val5 text);

The content of the table that I get is fine. However, I would like to get
appropriate names instead of arbitrary 'val1', 'val2', ...

Is it possible to rename the table columns with the result of 'select
distinct name from cth order by 1' ?

Thanks.


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[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