I'm trying to write a SQL query that will give me a list of duplicate persons in a database. I can not create a new table with this query.
I'm trying to find where persons have matching first name, last name and dates of birth.
The names are held in a table
You should be able to do this with:
select p.id, p.firstName, p.lastName, I.DoB, count(*) from persons as p join personsInfo as I on p.ID = i.PersonsID group by p.firstname, p.lastName, I.DoB having count(*) > 1
Found the answer by searching "select duplicates sql" and looking at this question and answer.