Value of select column as fieldname
Posted: Wed Mar 24, 2004 9:35 am
Question:
Can you use the value returned by a select as the "value as column" syntax ?
Example
to become
If you could I know you would need to use a nested select but I cannot find out how (if it is even possible).
I know I could process each of the columns using php but would prefer to try and simplify it within the db.
I am using POSTGRES.
Can you use the value returned by a select as the "value as column" syntax ?
Example
Code: Select all
value1 | unit1 | value2 | unit2 | value3 | unit3 | value4 | unit4
-------+-------+--------+-------+--------+-------+--------+-------+
0 | GB | 1 | MB | 0 | kB | 57 | BytesCode: Select all
GB | MB | kB | Bytes
-------+-------+-------+-------+
0 | 1 | 0 | 57I know I could process each of the columns using php but would prefer to try and simplify it within the db.
I am using POSTGRES.