Find Duplicate Records in SQLOracle. SQL Server, or Access | | How can I find duplicate records on a field in a database table? This works in SQL Server, Oracle, or Access.
Quite often I encounter the need to find duplicate rcords in database tables. This brief article will return a results set of duplicate records.
In order to find duplicate values in a table, use the following SQL.
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
| |