Tags
Asked 4 years ago
15 Aug 2020
Views 519
steave ray

steave ray posted

MySQL: RAND() returning same results in the SELECT statement?

i am working with script where i need to choose random customer for lottery ticketing winner . but thing is it always choosing almost same guys all the time


select * from users where RAND()


and it giving almost same result

it choosing only two guy one by one . so i wondering why is mysql RAND() function giving me same result .
jassy

jassy
answered Nov 30 '-1 00:00

use ORDER BY RAND()
instead of where RAND()

Following is the query
$query = "SELECT *
FROM users
ORDER BY RAND()
";
Post Answer