I need to pick 5 rows randomly form the database
how can i do so?
how to pick 5 random rows
Moderator: General Moderators
When will you start to look these things up yourself? I'm pretty sure the order by rand has been mentionned various times overhere... And the limit clause (or whatever it's called for your sql dbms) even more...
even "sql get 5 random rows" returns useful results in a search-engine.
http://www.petefreitag.com/item/466.cfm
even "sql get 5 random rows" returns useful results in a search-engine.
http://www.petefreitag.com/item/466.cfm
This sort of thing will do what you want.
easily found by googling tho
easily found by googling tho
Code: Select all
SELECT *
FROM table
ORDER BY RAND()
LIMIT 0,5