Mysql
 sql >> Datenbank >  >> RDS >> Mysql

SQL-Zeile in Spalten umwandeln

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