I have a table with such structure:
option_name | option_value
==========================
name        | GK
age         | 50
some_opt    | true
Can I write a query, that will rotate the table and get me results like this:
name  |  age   | some_opt
=========================
GK    |  50    | true
Also how would the query look, if each option would have a group id:
group_id  | option_name  | option_value
=======================================
1         | name         | GK
1         | age          | 50
2         | name         | ML
2         | age          | 34
1         | some_opt     | true
To provide such results:
group_id  | name  | age  | some_opt
=====================================
1         | GK    | 50   | true
2         | ML    | 34   | NULL
As per the other answer, my problem (with grouped parameters) can be solved with the following: http://buysql.com/mysql/14-how-to-automate-pivot-tables.html
Thanks!
