I have a
Person table and
Address Table. Their relationship is
Person.AddrId = Address.Id
Person table has
Address table has
I want to get all the list of duplicate records from this columns combination.
I tried below query:
SELECT A.FIRST_NAME, A.LAST_NAME, B.ADDR, B.ZIPCODE, count(1) FROM SCHEMA.PERSON A, SCHEMA.ADDRESS B WHERE A.ADDR_ID = B.ID group by A.FIRST_NAME, A.LASTT_NAME, B.ADDR, B.ZIPCODE having count(1) > 1
Unfortunately this gives only the duplicate records. I want both original as well as duplicate records.