ITPub博客

首页 > 应用开发 > IT综合 > 行转列问题

行转列问题

原创 IT综合 作者:cosio 时间:2007-08-02 22:12:36 0 删除 编辑
解决一网友提出的问题[@more@]代码:

select * from ttt;

T01 T02 T03
-------------------- -------------------- --------------------
1 3 4
1 5 6

已选择2行。


select distinct t01,
max(decode(t02,3,t02)) as t02,
max(decode(t03,4,t03)) as t03,
max(decode(t02,5,t02)) as t04,
max(decode(t03,6,t03)) as t05
from ttt
group by t01

T01 T02 T03 T04 T05
-------------------- -------------------- -------------------- -------------------- --------------------
1 3 4 5 6

已选择 1 行

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/101162/viewspace-930856/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-07-13

  • 博文量
    71
  • 访问量
    976099