A
AndyB
Access 2003:
I have a large table (several mm records) that has records with duplicate
values in some or all fields. I am trying to get separate counts for each
category. Separate queries are fine.
The query produced by the duplicates query wizard is fine where all fields
contain dups, but how do I find records where say 5 fields contain duplicate
values but 2 other fields do not?
I tried editing the SQL created by the duplicate query wizard but must have
done that incorrectly as I got an error:
You tried to execute a query that does not include the specified expression
'Count(*)>1 and .... as part of an aggregate function.
Here is the SQL created by the duplicates wizard:
SELECT table.Field1, table.Field2, table.Field3, table.Field4 table.Field5,
table.Field6, table.Field7, table.Field8, table.Field9, table.Field10 FROM
table
WHERE (((table.field1) In (SELECT [field1] FROM
As Tmp GROUP BY
[field1],[field2],[field3],[field4],[field5] HAVING Count(*)>1 And [field1]
=
.[field1] And [field1] =
.[field1] And [field2] =
.[field2] And [field3] =
.[field3] And [field4] =
.[field4] And [field5] =
.[field5])))
ORDER BY table.field1, table.field2, table.field3, table.field4, table.field5
Here’s my edit that created the error:
SELECT table.Field1, table.Field2, table.Field3, table.Field4 table.Field5,
table.Field6, table.Field7, table.Field8, table.Field9, table.Field10 FROM
table
WHERE (((table.field1) In (SELECT [field1] FROM
As Tmp GROUP BY
[field1],[field2],[field3],[field4] HAVING Count(*)>1 And [field1] =
.[field1] And [field1] =
.[field1] And [field2] =
.[field2] And [field3] =
.[field3] And [field4] =
.[field4] And [field5] =
.[field5] And
[field6]<>
.[field6] and [field7]<>
.[field7])))
ORDER BY table.field1, table.field2, table.field3, table.field4
I have a large table (several mm records) that has records with duplicate
values in some or all fields. I am trying to get separate counts for each
category. Separate queries are fine.
The query produced by the duplicates query wizard is fine where all fields
contain dups, but how do I find records where say 5 fields contain duplicate
values but 2 other fields do not?
I tried editing the SQL created by the duplicate query wizard but must have
done that incorrectly as I got an error:
You tried to execute a query that does not include the specified expression
'Count(*)>1 and .... as part of an aggregate function.
Here is the SQL created by the duplicates wizard:
SELECT table.Field1, table.Field2, table.Field3, table.Field4 table.Field5,
table.Field6, table.Field7, table.Field8, table.Field9, table.Field10 FROM
table
WHERE (((table.field1) In (SELECT [field1] FROM
[field1],[field2],[field3],[field4],[field5] HAVING Count(*)>1 And [field1]
=
ORDER BY table.field1, table.field2, table.field3, table.field4, table.field5
Here’s my edit that created the error:
SELECT table.Field1, table.Field2, table.Field3, table.Field4 table.Field5,
table.Field6, table.Field7, table.Field8, table.Field9, table.Field10 FROM
table
WHERE (((table.field1) In (SELECT [field1] FROM
[field1],[field2],[field3],[field4] HAVING Count(*)>1 And [field1] =
[field6]<>
ORDER BY table.field1, table.field2, table.field3, table.field4