表AF1 F2
============
001 40
001 10
001 20
002 5
003 7
003 8要求结果:F1 F2 No.
==============
001 40 1
001 10 2
001 20 3
002 5 1
003 7 1
003 8 2用一个SQL写,如何写呢,谢谢
============
001 40
001 10
001 20
002 5
003 7
003 8要求结果:F1 F2 No.
==============
001 40 1
001 10 2
001 20 3
002 5 1
003 7 1
003 8 2用一个SQL写,如何写呢,谢谢
解决方案 »
- 如何在存储过程中像另外一个数据库的表中插入数据
- 表内数据合并
- 帮忙解释一个现象
- 想恢复数据啊!
- 请问:EXEC SQL SELECT ename, sal, NVL(comm, 0) INTO :emprec INDICATOR :emprec_ind FROM EMP中的INDICATOR是什么意义啊?
- 基础问题
- OTN中文论坛,欢迎您提出自己ORACLE问题,供大家讨论,谢谢
- 这个procedure的select语句错在哪?(高分求助)
- 初学Oracle,有几个问题想在这儿问各位大虾。
- Oracle分区查询的问题
- Oracle 中,同一个表空间,不同用户对表中的数据操作会互相影响吗?
- 帮忙查看语法错误,从sql server转oracle,很多概念不一致
from (
select f1,f2
from table_x
where ....
order by ... )
2 union all select '001',10 from dual
3 union all select '001',20 from dual
4 union all select '002',5 from dual
5 union all select '003',7 from dual
6 union all select '003',8 from dual;6 rows insertedSQL> select * from tbl;F1 F2
---------- ------
001 40
001 10
001 20
002 5
003 7
003 86 rows selected
SQL> select f1,f2,row_number()over(partition by f1 order by f1) from tbl;F1 F2 ROW_NUMBER()OVER(PARTITIONBYF1
---------- ------ ------------------------------
001 40 1
001 10 2
001 20 3
002 5 1
003 7 1
003 8 26 rows selected