17,377
社区成员
发帖
与我相关
我的任务
分享
select * from T where not exists(select 1 from T a where busi_sid=a.busi_sid and CURSTATUSTYPE>a.CURSTATUSTYPE)
select BUSI_SID, LOGTYPE, subtype, CURSTATUSTYPE from (
select BUSI_SID, LOGTYPE, subtype, CURSTATUSTYPE, row_number() over(partition by BUSI_SID order by CURSTATUSTYPE desc) rn
from t) tab where rn = 1;
select distinct BUSI_SID,max(LOGTYPE),max(SUBTYPE),max(CURSTATUSTYPE) from 表 group by busi_sid
select * from t a
where not exists(select 1 from t b
where a.busi_id=b.busi_id and a.CURSTATUSTYPE<b.CURSTATUSTYPE)