ITPub博客

首页 > 数据库 > Oracle > sql实现行转列

sql实现行转列

原创 Oracle 作者:sembh 时间:2010-08-12 08:55:30 0 删除 编辑

今天遇到客户需要实现行列转换的功能。

号 名

001 2

001 3

002 4

002 6

变为

号 名1 名2

001 2 3

002 4 6

select *from (select b.no,b.mp_no a lead(a.mp_no)

over(partition by a.id order by a.mp_no desc) b

from table a, table b

where......)

where b is not null

[@more@]

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

上一篇: 认识数据仓库
下一篇: 实施aix系统备份
请登录后发表评论 登录
全部评论

注册时间:2010-07-08

  • 博文量
    70
  • 访问量
    589242