G
Guest
Hi,
I need to get only the first few results from a query in Access.
Unfortunately there appears to be a serious bug with Access' implementation
of SELECT TOP.
To duplicate this bug:
Create a table called TestTable
Add field: CustName (Text)
Add field: City (Text)
Add some test data making sure to add several entries with the same city
name. Then run:
SELECT TOP 3 TestTable.CustName, TestTable.City
FROM TestTable
ORDER BY TestTable.City;
With my test data I end up with 6 records in the results of this query. It
appears that when you combine SELECT TOP with ORDER BY, if the contents of
the field you are ordering on contain duplicates then Access may return all
of the duplicate rows as well.
Is there any way around this?
Thanks
Ben
I need to get only the first few results from a query in Access.
Unfortunately there appears to be a serious bug with Access' implementation
of SELECT TOP.
To duplicate this bug:
Create a table called TestTable
Add field: CustName (Text)
Add field: City (Text)
Add some test data making sure to add several entries with the same city
name. Then run:
SELECT TOP 3 TestTable.CustName, TestTable.City
FROM TestTable
ORDER BY TestTable.City;
With my test data I end up with 6 records in the results of this query. It
appears that when you combine SELECT TOP with ORDER BY, if the contents of
the field you are ordering on contain duplicates then Access may return all
of the duplicate rows as well.
Is there any way around this?
Thanks
Ben