Pivoting in MySQL converting rows into columns

Viewed 19

I have the following dataset and i would like to convert rows into columns

+----------+---------+
| assoc    | player  |
+----------+---------+
|        1 |      12 |
|        1 |      20 |
|        1 |      30 |
|        2 |      51 |
|        2 |      52 |
|        2 |      63 |
+----------+---------+

Making the view looks like

+----------+----------+----------+----------+
| assoc    | player1  | player2  | player3  |
+----------+----------+----------+----------+
|        1 | 12       | 20       | 30       |
|        2 | 51       | 52       | 63       |     |
+----------+----------+----------+----------+
0 Answers
Related