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

Access2000 Query to Randomly Return Every 9th Record

Status
Not open for further replies.

mpoor

MIS
Apr 9, 2002
11
US
I have a primary key auto number field. I would like to create a make table query to randomly return every 9th record. Anyone know how I would do this?
 
You could try the mod operator as the selection criteria. The mod operator will give the the remainder of the division of two integers. For example:

1 mod 9 = 1
2 mod 9 = 2
3 mod 9 = 3
4 mod 9 = 4
5 mod 9 = 5
6 mod 9 = 6
7 mod 9 = 7
8 mod 9 = 8
9 mod 9 = 0

Try this SQL:

SELECT *
INTO NewTable
FROM YourTable
WHERE ID mod 9 = 0

Given a uniform numbering sequence in the field named ID, this query will return every 9th record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top