萌新求问,表A变换成表B该怎么写sql解决呢?问了好多人都写不出
sql吧
全部回复
仅看楼主
level 1
2022年01月27日 07点01分 1
level 1
PIVOT 行列转化 可以
2022年01月27日 08点01分 2
level 5
select a,max(case when b=1 then c else null end ) as 1, max(case when b=2 then c else null end ) as 2,max(case when b=3 then c else null end ) as 3,max(case when b=4 then c else null end ) as 4 from 表 group by a
2022年01月28日 02点01分 4
level 4
列转行
2022年01月28日 12点01分 5
level 8
PIVOT
2022年02月28日 03点02分 7
1