Oracle查询结果行转列,列转行

行转列

select * from (select name, nums from demo/*任意查询语句*/) pivot (sum(nums) for name in ('测试1' 测试1, '测试2', '测试3'));

列转行

select id , name,xx demo from Fruit unpivot (demo for xx in (q1, q2, q3) )

猜你喜欢

转载自www.cnblogs.com/IceBlueBrother/p/9166766.html