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.
 
Back
Top