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

Random selections 1

Status
Not open for further replies.

KingSlick

Programmer
Mar 9, 2007
45
US
I am trying to select a certain number of records out of a table. The catch is that I want the records to be chosen at random. Is there a way in mysql that would allow me to a random selection?

Thanks in advance
-SM
 
Sure, in your select statement you can add [tt]ORDER BY RAND() LIMIT 10[/tt] to the end where 10 is your certain number.
 
I kept trying RANDOM(). I knew it was something that easy.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top