create table table1( a int, b int)
insert table1 select 11, 1
union all select 11, 1
union all select 11, 1
union all select 22, 1
union all select 22, 1
union all select 22, 1
union all select 22, 1
union all select 33, 1
union all select 33, 1
select id=identity(int,1,1), a,b into # from table1
select a,(select count(*) from # b where b.id<=a.id and b.a=a.a) from # a
drop table #
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货