Det bör vara en liknande fråga:
SELECT
cat,
SUM(IF(item = 0,data,0)) AS data0,
SUM(IF(item = 1,data,0)) AS data1
FROM table GROUP BY cat;
Det bör vara en liknande fråga:
SELECT
cat,
SUM(IF(item = 0,data,0)) AS data0,
SUM(IF(item = 1,data,0)) AS data1
FROM table GROUP BY cat;