Skip to content
Advertisement

SQL Find/Count similar duplicates

I am trying to to do a count on all records that are similar. Eg.

I have 2 records 1 is 1A Smith St and the other is 1 Smith St. So this data needs to be returned/counted as 1.

Any assistance would be gratefully appreciated.

Thanks enter image description here

enter image description here

Advertisement

Answer

Counting those where the (street, number) combination isn’t unique.

SELECT COUNT(*) AS Total
FROM
(
    SELECT Street, Number
    FROM your_table
    GROUP BY Street, Number
    HAVING COUNT(*) > 1
) q
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement