0

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    
');
matski
  • 541
  • 6
  • 19
  • This query does not select 50 random entries everytime, it just orders the result randomly based on how many columns you have. The fewer columns it returns the bigger chance you will see repetitions of entries each time the query is run – Ahmad Jul 21 '12 at 10:24

1 Answers1

0

Your questions makes it clear that you did not do enough research, because I just found this right away

Select n random rows from SQL Server table

Community
  • 1
  • 1
Ahmad
  • 12,336
  • 6
  • 48
  • 88
  • 1
    That is not what the OP is asking for and secondly he isn't using sqlserver but mysql. – Eddy Jul 21 '12 at 12:08