12 May, 2010

Select random rows from a table in MySQL

In order to select a random row from MySQL, we can order the rows by a random number and then pick the first row.

SELECT * FROM node ORDER BY rand() limit 1;

The above query randomly selects a row from the table node.


Comments (0) Post a comment
You may also like



Email Newsletter
Email:
Popular Posts
Recent Posts
Tags
Random photo
Barefoot Resort Reception Barefoot Resort Reception in Havelock Island Andaman
On Facebook
Recent Comments


digitalpbk