Problem and Solutions
Group by Max not desired results in SQL ?
By M.K. Verma · 4 May 2022

The last by PK row for a ContactId using top with ties
SELECT top(1) with ties *
FROM Contacts
ORDER BY row_number() over(partition by ContactID order by PK desc)