怎么实现交叉表形式啊?具体见内容
现在结构
order product price
1 A 11
1 B 12
1 C 16
2 B 13
2 C 15
希望能改成下面这样
order A B C
1 11 12 16
2 null 13 15
这个应该怎么实现啊?高手帮忙啊~~谢谢
------解决方案--------------------select order, sum(decode(product, A, price, null)) A,
sum(decode(product, B, price, null)) B,
sum(decode(product, C, price, null)) C
from tab
group by order