ACC1x: "Unique Values Only" Select Query Shows DuplicatesID: Q93692
|
The result of a query includes duplicate values even though you selected the Unique Values Only check box (SELECT DISTINCT) in the Query Properties dialog box.
Duplicate values occur when both of the following conditions are met:
SELECT DISTINCT [Order Details].[Order ID]
FROM [Order Details];
In addition to SELECT DISTINCT queries, you can use GROUP BYs in a
totals query to eliminate duplicates in the output. Both SELECT
DISTINCT queries and GROUP BYs in a totals query are limited to
10 columns. Usually, GROUP BY is faster when the resulting data set
is much smaller than the input data set, and SELECT DISTINCT is
faster when there are only a few duplicates.
To ensure the correct results, use GROUP BYs in a totals query instead
of using the Unique Values Only query property. For example, the
following two select queries give identical results:
SELECT DISTINCT [Order Details].[Order ID]
FROM [Order Details];
SELECT DISTINCTROW [Order Details].[Order ID]
FROM [Order Details]
GROUP BY [Order Details].[Order ID];
Microsoft has confirmed this to be a problem in Microsoft Access version 1.0. This problem was corrected in Microsoft Access version 1.1.
Microsoft Access "User's Guide," version 1.0, Chapter 6, "Designing Select Queries," pages 128-130 and 142-148
Keywords : kbusage QryOthr
Version : 1.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: March 12, 1999