Měl by to být podobný dotaz:
SELECT
cat,
SUM(IF(item = 0,data,0)) AS data0,
SUM(IF(item = 1,data,0)) AS data1
FROM table GROUP BY cat;
Měl by to být podobný dotaz:
SELECT
cat,
SUM(IF(item = 0,data,0)) AS data0,
SUM(IF(item = 1,data,0)) AS data1
FROM table GROUP BY cat;