1 列转行
select lcase(`name`) as `name`, sum(CASE TYPE when 'Breakfast' THEN `VALUE` else 0 end) as Breakfast, sum(CASE TYPE when 'Lunch' THEN `VALUE` else 0 end) as Lunch, sum(CASE TYPE when 'Supper' THEN `VALUE` else 0 end) as Super from cust_value group by `name`
标签:CASE,end,name,SQL,when,VALUE,else,MySQL From: https://www.cnblogs.com/chang09/p/17120763.html