Useful Article, in sense the author explain a new alternate of GROUP BY for DISTINCT ( Surely Unknown to many ).
For finding the Duplicates, the Query is Okay, but in many situation we are suppose to work on the duplicated data. So instead of Just check the Duplicates, we shall retrieve the total data by the below Query
-- To Check Duplicate Record
SELECT Address1,Address2,City,PostCode,Count(PostCode)
FROM AddressTable
GROUP BY Address1,Address2,City,PostCode
HAVING Count(PostCode) > 1
-- To Retrieve all records identified as Duplicate by some values
SELECT Address1, Address2, City, Postcode
FROM AddressTable a
WHERE (SELECT COUNT(*) FROM AddressTable b
WHERE a.Address1 = b.Address1 and a.Address2 = b.Address2
and a.City = b.City and a.Postcode = b.Postcode
) >1
May be useful to some one.....:-D
Thanks & Regards, Kartik M Kumar..