面试题:怎么把这样一个表儿aaayear month amount1991 1 1.11991 2 1.21991 3 1.31991 4 1.41992 1 2.11992 2 2.21992 3 2.31992 4 2.4查成这样一个结果year m1 m2 m3 m41991 1.1 1.2 1.3 1.41992 2.1 2.2 2.3 2.4答案一、select year, (select amount from aaa m where month=1 and m.year=aaa.year) as m1,(select amount from aaa m where month=2 and m.year=aaa.year) as m2,(select amount from aaa m where month=3 and m.year=aaa.year) as m3,(select amount from aaa m where month=4 and m.year=aaa.year) as m4from aaa group by year
添加回答
举报
0/150
提交
取消