慕娘9325324
WITH temp as ( select '111' as userid,'5' as status,'7' as ord from dual union all select '111' as userid,'0' as status,'9' as ord from dual union all select '111' as userid,'1' as status,'8' as ord from dual union all select '222' as userid,'3' as status,'3' as ord from dual union all select '222' as userid,'1' as status,'2' as ord from dual union all select '222' as userid,'2' as status,'4' as ord from dual union all select '333' as userid,'3' as status,'10' as ord from dual )select userid,status,ord from ( select userid,status,ord,row_number() over(partition by userid order by ord desc) rn from temp)where rn=1;