Randomly select a record in a table

D

DontKnow

Hi Guys,

How would I randomly select a record from a table that has some 2500 records?

Any help is greatly assisted!!

many thanks in adavnce!!

Cheers
 
J

John W. Vinson

Hi Guys,

How would I randomly select a record from a table that has some 2500 records?

Any help is greatly assisted!!

many thanks in adavnce!!

Cheers


SELECT TOP 1 *
FROM Yourtable
ORDER BY Rnd([fieldname])

where [fieldname] is some Number or Autonumber field which can be counted on
to contain a positive number.
 
D

DontKnow

Beautiful John!!

Many thanks!!

Cheers!!

John W. Vinson said:
Hi Guys,

How would I randomly select a record from a table that has some 2500 records?

Any help is greatly assisted!!

many thanks in adavnce!!

Cheers


SELECT TOP 1 *
FROM Yourtable
ORDER BY Rnd([fieldname])

where [fieldname] is some Number or Autonumber field which can be counted on
to contain a positive number.
 

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