程序笔记
随心而记
create table test (nu number);
insert into test values(1);
insert into test values(1
);
insert into test values(1
);
insert into test values(2);
insert into test values(3);
insert into test values(4
);
---------------------------------------
select a.*,row_number() over (order by nu) as rn from test a;

        NU         RN

---------- ----------
         
1          1
         1          2
         1          3
         2          4
         3          5
         4          6
select a.*,rank() over (order by nu) as rn from test a;

        
NU         RN
---------- ----------
         
1          1
         1          1
         1          1
         2          4
         3          5
         4          6
select a.*,dense_rank() over (order by nu) as rn from test a;
     NU         RN
---------- ----------
         
1          1
         1          1
         1          1
         2          2
         3          3
         4          4



 

posted on 2009-06-25 13:59    阅读(1089)  评论(0编辑  收藏  举报