If I have a db table, with the following fields, how do I find duplicate entries?
ID Fname Lname badgeID
select count(fname) as count from TABLE where count > 1 group by fname or select count(fname) as count from TABLE having count > 1 group by fname
I think
I need to make sure that all three fields Fname, Lname and badgeID (upper, lower or mixed case) match, i.e.
John Doe 87874 JOHN doe 87874
etc.
Perhaps something like:
select a.id from table a join table b on ( upper(a.fname) = upper(b.fname) AND upper(a.lname) = upper(b.lname) AND a.badgeid=b.badgeid AND a.id > b.id)