SQL817> select * from tb2; A B C
---------- ---------- ----------
1 2 100
1 2 200
1 3 100
1 3 300
1 3 500SQL817> select decode(rna,1,a,null) a,decode(rnb,1,b,null) b,c from
2 (
3 select a,b,c,row_number() over(partition by a,b order by a,b) rnb,
4 row_number() over(partition by a order by a) rna from tb2
5 )
6 / A B C
---------- ---------- ----------
1 2 100
200
3 100
300
500SQL817>
---------- ---------- ----------
1 2 100
1 2 200
1 3 100
1 3 300
1 3 500SQL817> select decode(rna,1,a,null) a,decode(rnb,1,b,null) b,c from
2 (
3 select a,b,c,row_number() over(partition by a,b order by a,b) rnb,
4 row_number() over(partition by a order by a) rna from tb2
5 )
6 / A B C
---------- ---------- ----------
1 2 100
200
3 100
300
500SQL817>
解决方案 »
- oracle/sp
- oracle恢复之后em无法打开
- oracle ebs开发:如何取得form的任意两条记录
- oracleConnection是线程安全的吗
- 取前10行不用 rownum<=10 怎么取??
- case when 同时判断两列
- 有关于游标的问题,请大虾们指教
- 如何将oracle8.1.6下的一个.dbf文件导入到oracle9i?急!在线等待。
- 安装oracle客户端?非得用软件来装么,可不可以通过copy文件的方式?只要客户端的应用程序可以使用就行了。怎么做?
- 连续请了3个高手都无法搞定的问题!(在线等待)
- 求教dba_data_files,dba_free_space中的问题
- oracle中插入语句怎样实现自增长字段的返回
能解释这几个函数的用处吗?谢谢了
1 分析函数row_number将记录集按字段分组取出行号
2 decode处理显示行号为1 的记录,其它的取null
over(partition by a,b order by a,b)是什么语法?