Page 1 of 1

Random Select

Posted: Fri May 02, 2003 7:57 am
by mzfp2
Hi

is it possible to select say 5 random records from a database (MYSQL) which satisfy a certain criteria, eg SELECT RANDOM(5) from useers where user='alive'?

or would it need some sort of PHP intervention?

Thanks

Posted: Fri May 02, 2003 7:58 am
by []InTeR[]
Yes

SELECT * FROM `table` ORDER BY RAND() LIMIT 5


PS: Request move to databases.

Posted: Fri May 02, 2003 8:00 am
by mzfp2
great thanks! lightening response and the solution too .. thanks a billion man

Posted: Fri May 02, 2003 8:00 am
by []InTeR[]
I hava nothing else to do :)