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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP... Getting every 10th record

Status
Not open for further replies.

Majaws2

Programmer
Jul 3, 2003
15
US
Can't get this to work for me any way I try.. I had it before and lost the DB. I need to have a query that will pull every 10th record from another query or table....Anyone know how please help me...
 
Because there is no guaranteed default ordering of records in a table, the interpretation of "every 10-th record" is not well defined or is defined only in the context of some "ORDER BY" specification.

If you had a field containing numeric values (an autonumber for example) then you could use SQL like
Code:
Select AnumField From tbl
Where (AnumField MOD 10) = 0
Which returns every record where AnumField is a multiple of 10 (not quite the same thing.)

For a discussion of this issue see Rudy Limebeck's site at


 
Yup, unless you put an "ORDER BY" clause on your SELECT, you'll get the rows in whatever order the database engine finds most efficient.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top