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

Zeilen in Spalten mit Summe gruppieren

select name, 
       sum(case when `type` = 'Cash' then `value` else 0 end) as Cash,
       sum(case when `type` = 'Card' then `value` else 0 end) as Card
from your_table
group by name