I have a mysql table that looks something like this:
id | col_1 | col_2 | col_3 ---|-------|-------|------ 1 | 2 | 34 | 64 2 | 6 | 53 | 23
I would like to be able to request an identifier and get multiple rows, one for each column. For example:
SELECT column_name as column, column_value as value FROM my_table WHERE id=1;
Which would give me:
column | value -------|------- col_1 | 2 col_2 | 34 col_3 | 64
What should I use to formulate such a request?
Many thanks
mysql pivot
Thomas clayson
source share