ACC: Sort Order of Union Queries Affected by ALL Predicate (117164)
The information in this article applies to:
- Microsoft Access 2.0
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q117164
Moderate: Requires basic macro, coding, and interoperability skills.
SUMMARY
The data from a union query appears to be sorted automatically according to
values in the first column selected even when the query does not have an
explicit ORDER BY clause. This happens because, by default, union queries
do not return duplicate records; they perform an implicit DISTINCT. To
determine distinct rows of data, a union query sorts the data.
Duplicate records are not returned unless UNION ALL is used. When the ALL
predicate is used, the union query's rows are returned unsorted unless an
ORDER BY clause in included in the last SELECT statement.
REFERENCES
For more information about union queries, search the Help Index for "union
queries," or ask the Microsoft Access 97 Office Assistant.
Modification Type: | Major | Last Reviewed: | 5/6/2003 |
---|
Keywords: | kbinfo kbusage KB117164 |
---|
|