How do I write a SELECT query to get every fifth record?

P

prphan

I want to write a SELECT query that will give me every fifth record. I have
one on another issue that is a "SELECT TOP 15" and a basic "SELECT COUNT".
What do I have to change in the wording to get every fifth record?

Thanks.

Michael Heiter
 
B

Brendan Reynolds

The answer depends on your definition of 'fifth'. In this example, the
definition is: the value of the sequential number field 'TestNum' can be
evenly divided by five ...

SELECT tblTest.TestNum, tblTest.TestText
FROM tblTest
WHERE ((([TestNum] Mod 5)=0))
ORDER BY tblTest.TestNum;
 
P

prphan

Worked like a charm. Thanks a bunch.

Brendan Reynolds said:
The answer depends on your definition of 'fifth'. In this example, the
definition is: the value of the sequential number field 'TestNum' can be
evenly divided by five ...

SELECT tblTest.TestNum, tblTest.TestText
FROM tblTest
WHERE ((([TestNum] Mod 5)=0))
ORDER BY tblTest.TestNum;

--
Brendan Reynolds (MVP)

prphan said:
I want to write a SELECT query that will give me every fifth record. I
have
one on another issue that is a "SELECT TOP 15" and a basic "SELECT COUNT".
What do I have to change in the wording to get every fifth record?

Thanks.

Michael Heiter
 

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