Find MYSQL Duplicate records
In : mysql, Posted by admin on Mar.03, 2009
If the database has a table call employees. The values are:
ID Name
1 a
2 b
3 a
4 c
5 b
You want to find the duplicate record but not the first one (ie, ID# 3 and 5). You can do the following:
select id from employees where id not in (select distinct id from employees group by name);
Tags : interview question, mysql
Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment