Taurus II
Wednesday, 14 September 2011
MYSQL select random records
If you need to select <n> number of sample records at random, you could try the following. Though, it can be resource intensive.
Code:
SELECT *
FROM members
WHERE (email != '' AND email NOT NULL)
ORDER BY RAND() LIMIT 0,100;
This example will select 100 records at random.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment