MySQL SQL题
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`