日期:2014-05-19  浏览次数:20610 次

奇怪,郁闷,行转列为什么结果不对?大家帮帮我
TB1:
订单号       数量
1                 10
2                 5
3                 8

要求结果:
1       2       3
10     5       8

应该怎么写?

------解决方案--------------------
select max(case when 订单号=1 then 数量 end),
max(case when 订单号=2 then 数量 end),
max(case when 订单号=3 then 数量 end) from tb1