MySql Random Records

Must Read : MySql Random Records

Many people look for how to fetch a records from Mysql DB in any random Order.

Here is the solution for it.

Code.

 

SELECT id, title, description
FROM items
WHERE active = 1
ORDER BY RAND()
LIMIT 10

The ORDER BY RAND() clause returns random records!

Thank you!

 

(Visited 36 times, 1 visits today)

Leave a Comment.