forum

Home / DeveloperSection / Forums / SQL selecting random rows, but not reselecting them next time

SQL selecting random rows, but not reselecting them next time

Jayden Bell171606-May-2013
Hi Everyone!

I'm making a random selection of 50 items, but when another call is made, I want to select another random 50 that DOES NOT include anything selected previously. How 

best to do this? Is there an SQL statement that handles this?

// Collect 50 random entries
$stmt = $db->query('
SELECT * FROM db
ORDER BY RAND() 
LIMIT 50    
');

Thanks in advance! 

Updated on 06-May-2013

Can you answer this question?


Answer

1 Answers

Liked By