select * from (select ROW_NUMBER() OVER (partition by policy_id, unit_Number order by unit_id desc ) r# , MAX(unit_ID) over (partition by policy_id, unit_Number ) preferred_unit_id , m.* from unit_table m) where r# > 1