Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number of rows returned in an access query

Status
Not open for further replies.

fordtran

Programmer
Jun 15, 2005
101
ZA
I have a problem returning an exact number of rows from an Access database.
I would read the data from the database with a 'select top 7 from ....' and many times it does select only 7, but sometimes it selects more than 7.
For instance, if I select the top 7 by a date field and more than 7 contains the specific date it selects all the items with that specific date. It seems to me that it cannot discriminate between the rows with the same value for the date field.
Can somebody please help.

Thanks

fordtran


fordtran
 
Use the distinct key word:

SELECT distinct top 3 Mailinglist.Second
FROM Mailinglist
ORDER BY Mailinglist.Second DESC;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top