Thread: Order by rand()
View Single Post
Old 06-08-2008, 07:09 PM   #1 (permalink)
Jmz
The Acquainted
 
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
Jmz is on a distinguished road
Default Order by rand()

I have a query that looks like:

Code:
SELECT * FROM tbl_gallery WHERE fld_userid = $UserID ORDER BY RAND() LIMIT 4
I've read that using rand() isn't a good idea as it takes a lot of system resources. How can I rewrite the query to do the same thing without putting too much strain on my server?
__________________
Free CSS Tutorials
Send a message via MSN to Jmz
Jmz is offline  
Reply With Quote