create table test1
(a int ,b int ,c int)
insert into test1(a,b,c)
values(1,1,1)
insert into test1(a,b,c)
values(1,1,2)
insert into test1(a,b,c)
values(1,1,3)
insert into test1(a,b,c)
values(1,1,4)
insert into test1(a,b,c)
values(1,2,1)
insert into test1(a,b,c)
values(1,2,2)
insert into test1(a,b,c)
values(1,2,3)
insert into test1(a,b,c)
values(1,2,4)
insert into test1(a,b,c)
values(1,3,1)
insert into test1(a,b,c)
values(1,3,2)
insert into test1(a,b,c)
values(1,3,3)
insert into test1(a,b,c)
values(1,3,4)
SELECT * from test1
select * from test1 where
c>=(select min(c) from (select top 3 c from test1 t where t.b=test1.b order by c desc)a)