22,206
社区成员
发帖
与我相关
我的任务
分享
select
a.*
from
tb a
join (select min(ID3)ID3,id2 from tb group by id2) b on
a.id2=b.id2
and
a.ID3=b.ID3
SELECT ID1,ID2,MAX(ID3) 'ID3' FROM TB
GROUP BY ID1,ID2
select * from tb t where not exists(select 1 from tb where id1=t.id1 and id2=t.id2 and id3>t.id3)