--生成测试数据
declare @t table(a int , b int)
insert into @t select 1,1101
union all select 1,2321
union all select 1,3243
union all select 2,3211
union all select 2,2432
union all select 2,3007
union all select 2,4425
union all select 2,3325
union all select 3,2561
union all select 3,6422
union all select 3,2563
--解决方法
select *,c=(select count(*) from @t b where a.a=b.a and a.b>=b.b) from @t a
order by 1,2