finding duplicates
I'm trying to get duplicate entries in a table and I need to match the id field with another table. I found duplicates with a query but couldn't get the id as well, so I found this on a web site to retrieve duplicates with id (a modified version of the query I was using). It doesn't work though and I'm not sure why. I get the error: Incorrect syntax near ','. I can't see where it's complaining about. It's an MSSQL database.
SELECT id, Lname, Fname
FROM clients
WHERE (Lname, Fname) IN
(SELECT Lname, Fname
FROM clients
GROUP BY Lname, Fname
HAVING COUNT(*) > 1)
ORDER BY Lname, Fname
Can anyone help?
