56,677
社区成员
发帖
与我相关
我的任务
分享
select id1,id2,name
from table2 a inner join table1 b on a.id1=b.id1
where a.id2 = (select max(id2) from table2 where id1=a.id1) ;
select *
from table2 a
where id2 = (select max(id2) from table2 where id1=a.id1) ;