0

Is there is any way to get the select Random Records using query from table in mySql.

Vicky
  • 9,515
  • 16
  • 71
  • 88
  • duplicate: http://stackoverflow.com/questions/142242/what-is-the-best-way-to-pick-a-random-row-from-a-table-in-mysql – Mitch Wheat Mar 09 '10 at 07:17

2 Answers2

2

How about something like

SELECT * FROM `table` ORDER BY RAND() LIMIT 0,1;
Adriaan Stander
  • 162,879
  • 31
  • 289
  • 284
0
SELECT * FROM `table` WHERE RAND() < 0.5

change the percentage to include more or less records. add a LIMIT clause to, well, limit to a maximum number of records

knittl
  • 246,190
  • 53
  • 318
  • 364