1.这是源数据以及需要转化的目标表. 我们的方法是 , 用 GROUP BY按照year分组 , 并且依次提取1月,2月,3月,4月的 num,具体实现 1 2 3 4 5 6 select year, max(case when month=1 then money else 0 end) as M1, max(case when month=2 then money else 0 end) as M2, max(case when month=3