sql 同时实现行转列和列转行
select Name,序号,类型, [1月]=MAX(case when Month=1 then Value end), [2月]=MAX(case when Month=2 then Value end), [3月]=MAX(case when Month=3 then Value end) from ( select Name,Month,'序号'=1,'类型'='吃饭',Meet as Value from aaa union all select Name,MONTH,'序号'=2,'类型'='唱歌',Singing as Value from aaa union all select Name,MONTH,'序号'=3,'类型'='游戏',Game as Value from aaa ) as BBB group by BBB.Name,BBB.序号,BBB.类型