-----------------结果集为刚好分组后每组中记录数为3个 select * from b t where (select count(*) from b where a = t.a and b > t.b) <3 and exists(select count(*) from b where a=t.a group by a having count(*)>=3) go ----------------结晶集为分组后每组中记录数为》=3个 select * from b t where exists(select count(*) from b where a=t.a group by a having count(*)>=3)