T1 is a table that contains all the values I want as a column name:
---------------
| T1 |
---------------
| id | v1 |
---------------
| 1 | a |
---------------
| 2 | b |
---------------
| 3 | c |
---------------
T2 is a table that contains all my data:
-------------------------------
| T2 |
-------------------------------
| id | art | t1v1 | v1 |
-------------------------------
| 1 | 10 | a | z |
-------------------------------
| 2 | 10 | c | y |
-------------------------------
| 3 | 11 | a | x |
-------------------------------
| 4 | 11 | b | w |
-------------------------------
| 5 | 11 | c | v |
-------------------------------
T3 is the view I want to create. The columns' name are the values from the column named v1 in T1:
---------------------------
| T3 |
---------------------------
| art | a | b | c |
---------------------------
| 10 | z | | y |
---------------------------
| 11 | x | w | v |
---------------------------
I tried a lot of solutions using GROUP_CONCAT
in SELECT
but I didn't find anything to create multiple columns based on line values. Is there a way to create that kind of views ?