हम्म। यह एक प्राथमिकता क्वेरी है। ऐसा लगता है row_number()
के लिए कहा जाता है:
select t1.personid, t1.employment
from (select t1.*,
row_number() over (partition by personid
order by (case when employment <> 'Stayed the same' then 1 else 2 end),
date desc
) as seqnum
from t1
) t1
where seqnum = 1;