Could somebody help with my SQL?
I have a table with records such as:
ID | Car_num | Service | Price ---+---------+---------+------ 1 | 001 | sh
Try this:
SELECT ID, Car_num , SUM(IF(Service = 'shower', Price, 0)) AS Shower , SUM(IF(Service = 'TV', Price, 0)) AS TV FROM your_table GROUP BY Car_num;