I have written code to find duplicate records in a SQL Server table when 5 columns match, please confirm this code is correct or advise any changes.
SQL:
select UAID, URA_ID, UADesc,URADesc, URASDHCode, COUNT(*)
from table
where UAID = UAID
group by UAID, URA_ID, UADesc,URADesc, URASDHCode
having COUNT(*)>1
Retrieve records only when 5 columns match, there are more than 20 columns in a table.