首先数据是这样的 

Oracle行转列

我想要的是TEGION的不同值是列,就是

Oracle行转列

TEGION= 3,TEGION=2的列下面的是num的值

实现sql:select * from tmp_2 pivot(max(num) for tegion in ('3' sn,'2' sw))

说明:pivot(聚合函数 for 列名 in(列值)),in里面也可以指定子查询,如:select distinct tegion from tmp_2

相关文章:

  • 2021-09-01
  • 2021-09-21
  • 2021-11-18
  • 2022-12-23
  • 2022-01-19
  • 2021-07-29
猜你喜欢
  • 2021-04-10
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案