Order by specified primary key column when validating duplicates