I have been trying to find duplicate county names in a state according to StateId. I have tried to write a SQL query that helps to find duplicate data, but I could not.
SELECT LOWER(Name) COLLATE SQL_Latin1_General_CP1_CI_AI, StateId FROM County (nolock) GROUP BY Name, StateId HAVING (COUNT(*) > 1) I would be very happy if someone could help.

GROUP BY LOWER(Name) collate SQL_Latin1_General_CP1_CI_AI, StateId.NOLOCK? YOu *do understand what it does, right? For what you're doing, I'd suggest that it is actually likely to give you incorrect results if work on the data in the table is being done.