Create a query that will select random data from my databse

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I am creating a database and i want to generate a query where my selected
number of data (say 50 out of 100) gets selected randomly. Is it possible?

Any help will be highly appreciated
 
Kaushal Shah said:
I am creating a database and i want to generate a query where my selected
number of data (say 50 out of 100) gets selected randomly. Is it possible?


SELECT TOP 50 f1,f2,...
FROM table
ORDER BY Rnd(fx)

Where fx is any field that guaranteed to have a numeric
value greater than zero.

Also, be sure to use the Randomize statement somewhere
before running the query.
 
Thank you for your response!

Marshall Barton said:
SELECT TOP 50 f1,f2,...
FROM table
ORDER BY Rnd(fx)

Where fx is any field that guaranteed to have a numeric
value greater than zero.

Also, be sure to use the Randomize statement somewhere
before running the query.
 

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

Back
Top