表数据
想要查询的格式
实现横排的sql语句
select `year` as "年份", max(case when `quarter` = 1 then volume else null end) as "一季度",
max(case when `quarter` = 2 then volume else null end) as "二季度",
max(case when `quarter` = 3 then volume else null end) as "三季度",
max(case when `quarter` = 4 then volume else null end) as "四季度"
from sale_report
GROUP BY `year`