oracle行转列
- -oracle 字段t1:商家cd t2:托盘cd t3:空数量
- --测试过,能用,不知是否满足要求?
- select t.t1,
- sum (decode(t.t2, 'm1' ,t.t3,0))m1,
- sum (decode(t.t2, 'm2' ,t.t3,0))m2,
- sum (decode(t.t2, 'm3' ,t.t3,0))m3,
- sum (decode(t.t2, 'm4' ,t.t3,0))m4,
- sum (decode(t.t2, 'm8' ,t.t3,0))m8
- from a t
-
group
by
t.t1