Hmmm. Il s'agit d'une requête de priorisation. Cela ressemble à row_number()
est appelé pour :
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;