34,873
社区成员
发帖
与我相关
我的任务
分享
select id,name,max(age) from tb group by name
select * from tb where id in(select id from tb , (select name ,max(age) as age from tb group by name)aa
where tb.name=aa.name and tb.age=aa.age)select * from tb t where age=(select max(age) from tb where name=t.name)
select * from tb t where not exists(select 1 from tb where name=t.name and age>t.age)
select *
from tb t
where id = (select top 1 id from tb where name = t.name order by age desc)
select * from tb a
where age=(select max(age) from tb where name=a.name)