--没测试过...lz看看行不行?
--是在userid 没有重复的情况下使用
select *
from userT a
where userid in (select top 100 userid from userT where province =a.province order by userid )
例如:
A B C
1 1 2
1 2 3
1 9 4
2 5 7
2 4 10
2 8 5
select A,B,C from t1 t
where (select count(1) from t1 t2 where t2.A=t.A and t.C<=t2.C)>2
这是前两名,>100就是前100了