Thanks a bunch. However, I need to still pull all the other columns such as Address, City, State to this report. I also need to pull duplicated rows instead of just one row for each duplicate set of records.
It is posible for other columns to be different between the records but as long as the FName, LName, and ZipCode are the same, they should be considered duplicates.
The reason is to eliminate those that were not duplicated. E.g. If you have:
John Maxwell 111 crogo rd. Albany, NY 62000
John Maxwell 111 crogo rd. Albany, NY 62000
David Taylor 105 Baylor Dr. Baltimore, MD 23100
Jeff Daniels 200 crogo rd. Richmond, VA 34511
Jeff Daniels 1 Mayberry Dr. Richmond, VA 34511
Mary Kay 50 crogo rd. St. Louis, MO 63136
The result should be:
John Maxwell 111 crogo rd. Albany, NY 62000
John Maxwell 111 crogo rd. Albany, NY 62000
Jeff Daniels 200 crogo rd. Richmond, VA 34511
Jeff Daniels 1 Mayberry Dr. Richmond, VA 34511
select tbl1.*
from
CustInfo AS tbl1
inner join (select FName, LName, ZipCode FROM CustInfo
group by FName, LName, ZipCode
having Count(*) > 1) AS tbl2
ON tbl1.fname = tbl2.fname and tbl1.lname = tbl2.lname and tbl1.zipcode = tbl2.zipcode
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.