试试看: select * from t where (a,b) in (select a,max(b) from t group by a)
提供另一种语法select a,b,c ( select a,b,c ,row_number() over(partition by a order by b desc) rn from ) where rn = 1
select * from T t1 where not exists(select null from T t2 where t2.id=t1.id and t2.b>t1.b)
select m.* from t m where not exists(select 1 from t n where n.a = m.a and n.b > m.b)select m.* from t m where b = (select max(b) from t n where n.a = m.a)
select * from t where (a,b) in (select a,max(b) from t group by a)
(
select a,b,c
,row_number() over(partition by a order by b desc) rn
from
)
where rn = 1
select * from T t1
where not exists(select null from T t2 where t2.id=t1.id and t2.b>t1.b)
select m.* from t m where not exists(select 1 from t n where n.a = m.a and n.b > m.b)select m.* from t m where b = (select max(b) from t n where n.a = m.a)