Subscribe by Email

Your email:

Browse by Tag

Insights & Information regarding enterprise resource planning software from a leading industry expert.

Current Articles | RSS Feed RSS Feed

Finding Duplicate Records in a Database Table

  
  
  
  
  
  
  

I often need to find duplicate records in a database table.  The following SQL expressions (which work in SQL, Oracle or Access as well) will return a result set of duplicate records:

Simple:

select distinct employee from employees (nolock)
group by employee
having count(employee) > 1
order by employee

Complex:

select employee, firstname, lastname, dob
from employees (nolock)
where employee in
(select employee from employees (nolock)
group by employee
having count(employee)>1)
order by employee

 

Comments

Currently, there are no comments. Be the first to post one!
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics

This Web site is owned by Plus Computer Solutions Ltd. Plus Computer Solutions Ltd. is independent from Sage and is not authorized to make any statement, representation or warranties or grant any license or permission on behalf of Sage regarding any product, service or Web site content. Certain materials made available on or through this Web site are owned by Sage and cannot be used without the prior written permission of Sage.