================================================================== 赞同more_zou的意见,如: SQL> break on 字段1 SQL> select 字段1,字段2 from 表 order by 字段1就能得到你要的效果:)
SQL> select * from aa;ID FID -- --- 1 0 2 1 3 1 4 2 5 3 6 4 6 5SQL> select decode(rm,1,id,null) id,fid from 2 (select id,fid,row_number() over(partition by id order by rownum) rm from aa);ID FID -- --- 1 0 2 1 3 1 4 2 5 3 6 4 57 rows selected楼主的语句: select decode(rm,1,字段1,null) 字段1,字段2 from (select 字段1,字段2,row_number() over(partition by id order by rownum) rm from your_table);
在sqlplus中,可以输入break on 字段1,再写查询
==================================================================
赞同more_zou的意见,如:
SQL> break on 字段1
SQL> select 字段1,字段2
from 表
order by 字段1就能得到你要的效果:)
-- ---
1 0
2 1
3 1
4 2
5 3
6 4
6 5SQL> select decode(rm,1,id,null) id,fid from
2 (select id,fid,row_number() over(partition by id order by rownum) rm from aa);ID FID
-- ---
1 0
2 1
3 1
4 2
5 3
6 4
57 rows selected楼主的语句:
select decode(rm,1,字段1,null) 字段1,字段2 from
(select 字段1,字段2,row_number() over(partition by id order by rownum) rm from your_table);