日期:2014-05-17 浏览次数:21415 次
select a , b, c, row_number() over(partition by a , b, c order by a , b, c) rw from tb
------解决方案--------------------
create table tb(a int,b int,c int) insert into tb values(1,1,2) insert into tb values(1,1,2) insert into tb values(1,2,3) insert into tb values(2,2,2) select a , b, c, row_number() over(partition by a , b, c order by a , b, c) rw from tb /* A B C RW --------------------------------------- --------------------------------------- --------------------------------------- ---------- 1 1 2 1 1 1 2 2 1 2 3 1 2 2 2 1 4 rows selected */ drop table tb
------解决方案--------------------
楼上正解!
------解决方案--------------------
--晕,没看到你最后一句话要按a,b,c分组 row_number()over(partition by a,b,c order by a,b,c)
------解决方案--------------------