Mysql
 sql >> Database >  >> RDS >> Mysql

Converti riga sql in colonne

SELECT A,
MAX(CASE WHEN B=1 THEN c END) AS C1,
MAX(CASE WHEN B=2 THEN c END) AS C2, // etc for B=3,4
FROM table1
GROUP BY A