ACC1x: How to Query for Duplicate RecordsID: Q98230
|
When you import data from other databases, records may contain
duplicate information in the primary key fields. You can run a
make-table query to eliminate the duplicate data, but if key fields
for two or more records contain the same value, you may want to
reconcile the information manually to make the records unique.
This article includes sample queries and shows how to list duplicate
information for keys containing single fields or multiple fields.
Table: MyTable
-------------------------------
Field: Name
Indexed: Yes (Duplicates OK)
Query: Find Duplicates
----------------------
Field: Name
Total: Group By
Field: Name
Total: Count
Criteria: >1
The equivalent SQL statement is as follows:
SELECT DISTINCTROW
Name, Count(Name) As CountOfName
FROM
MyTable
GROUP BY
Name
HAVING
Count(Name)>1
WITH OWNERACCESS OPTION;
Table: MyTable
-------------------------------
Field: First Name
Indexed: Yes (Duplicates OK)
Field: Last Name
Indexed: Yes (Duplicates OK)
Query: Find Duplicates
----------------------
Field: Last Name
Total: Group By
Field: First Name
Total: Group By
Field: First Name
Total: Count
Criteria: >1
The equivalent SQL statement is as follows:
SELECT DISTINCTROW
[Last Name], [First Name],
Count([First Name]) As [CountOfFirst Name]
FROM
MyTable
GROUP BY
[Last Name], [First Name]
HAVING
Count([First Name])>1
WITH OWNERACCESS OPTION;
Keywords : kbusage QryMktbl
Version : 1.0 1.1
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 23, 1999