MOD Function Question

M

Michelle B.

Hi,

Can anyone tell me how to use the MOD function to Nth a
quantity into thirds? I need to pull every third record
for a mailing. I've used it before to pull all the odd
records for a mailing but it's been so long I forgot how
to use it. Or if there is a better way than using the MOD
function, please let me know.

Thank you,

Michelle Bardin
 
B

Brian Camire

Assuming you've got a field (say, named "Your Field") with non-negative,
whole number values that are uniformly distributed, you might use a query
whose SQL looks something like this:

SELECT
[Your Table].*
FROM
[Your Table]
WHERE
[Your Table].[Your Field] Mod 3 = 0

If your field doesn't satisfy these assumptions (but "Your Field" has at
least non-Null number values), and you don't mind if the records are
randomly selected or if you get slightly more or less than 1/3 of the
records, you might try a query whose SQL looks something like this:

SELECT
[Your Table].*
FROM
[Your Table]
WHERE
Rnd([Your Table].[Your Field])<1/3
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top