Can we use a sql data field as column name instead?
Posted
by
Starx
on Stack Overflow
See other posts from Stack Overflow
or by Starx
Published on 2011-01-13T12:32:45Z
Indexed on
2011/01/13
12:53 UTC
Read the original article
Hit count: 156
First a query
SELECT * FROM mytable WHERE id='1'
Gives me a certain number of rows For example
id | context | cat | value
1 Context 1 1 value 1
1 Context 2 1 value 2
1 Context 1 2 value 3
1 Context 2 2 value 4
Now my problem instead of receiving the result in such way I want it is this way instead
id | cat | Context 1 | Context 2
1 1 value 1 value 2
1 2 value 3 value 4
© Stack Overflow or respective owner