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

Select a Random Number of Records

Status
Not open for further replies.

speltrain

Technical User
Apr 29, 2003
17
US
I have a pretty simple database application consisting of some forms queries and tables. The main point is that I need to select a random 10% of the records in table tblMain and place them in a new table tblAudit.

Is there a way to do this simply within SQL or can someone help me out with the coding.

I'm kind of new to this SQL stuff and just starting to figure it out.

Thanks
 
Check out Bob Schriver's technique in thread701-824877.
 
Thanks Golom for the referral.

Speltrain: You can modifiy the technique slightly to include the PERCENT capability by modifying the code in the last section. Just add the word PERCENT in front of the star(*) where the codes builds the new query SQL string. Make sure a space is maintained in front of PERCENT.

Good luck.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Thanks guys, I got it to work with the code from the refered post. Thanks Bob
 
Glad that Golom and I could help you with this situation.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top