34,594
社区成员
发帖
与我相关
我的任务
分享
create table tale (t1 int ,t2 varchar(10))
insert tale
select 1 , 'a' union all
select 2 , 'a' union all
select 3 , 'b' union all
select 4 , 'b' union all
select 5 , 'c' union all
select 6 , 'c' union all
select 7 , 'c'
select * from tale a where not exists(select 1 from tale where t2=a.t2 and t1<a.t1 )
select * from tb t where t1=(select min(t1)from tb where t2=t.t2)
SELECT * FROM TB T WHERE NOT EXISTS(SELECT 1 FROM TB WHERE T.T1>T1 AND T.T2=T2)
select * from tale where t1 in(select min(t1) from tale group by t2)