Page 1 of 1

Mysql RAND() functionatility

Posted: Thu Aug 14, 2003 10:49 am
by Nunners
I have a mysql statement which produces a list of accommodation within a certain area. Within the list, they are sorted by Accommodation type, and rating. Once at that level, I want the list to be sorted randomly - and different each time.

My current sql statement is:

Code: Select all

select list of fields required from 2 tables where various statements ORDER BY ACCOM_TYPE ASC, RATING DESC, RAND()
How does the RAND() behave? I've seen somewhere that it is not very efficient, particularly with large lists.
Has anyone else got any experience of trying to randomise large lists, and done it efficiently and successfully?

Cheers
Nunners