dbTalk Databases Forums  

Selecting a random sample in a query

comp.databases.ms-access comp.databases.ms-access


Discuss Selecting a random sample in a query in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Derrick J
 
Posts: n/a

Default Selecting a random sample in a query - 11-16-2010 , 02:12 PM






For auditing purposes, I have a a table with 1000 records. I want to filter
for a criteria that gives me 100 records I want to audit, but I only want to
select a sample of 20 lets say. Is there a way I can tell Access to select
every 5th record for example?

Thanks

Reply With Quote
  #2  
Old   
Vern DeHaven
 
Posts: n/a

Default Re: Selecting a random sample in a query - 11-17-2010 , 05:19 PM






Derrick,

Pick a key field you can use as a comparison for SomeKey. You may try
something of this sort:

SELECT * FROM (
SELECT (SELECT Count(SomeKey) FROM Audit A WHERE A.SomeKey <=
Audit.SomeKey) AS skCount, OtherField1, OtherField2
FROM Audit
) WHERE skCount mod 5 = 0

Regards,
Vern

On Nov 16, 3:12*pm, "Derrick J" <derr... (AT) noemail (DOT) com> wrote:
Quote:
For auditing purposes, I have a a table with 1000 records. I want to filter
for a criteria that gives me 100 records I want to audit, but I only wantto
select a sample of 20 lets say. Is there a way I can tell Access to select
every 5th record for example?

Thanks

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.