here's one method --
Code:
( SELECT url_url, url_module, url_title
FROM urls
WHERE url_module = 'forum'
ORDER BY RAND() LIMIT 1 )
UNION ALL
( SELECT url_url, url_module, url_title
FROM urls
WHERE url_module = 'products'
ORDER BY RAND() LIMIT 1 )
UNION ALL
.
.
.
this is 5 times as slow, however, as pulling say a dozen random rows and looping through them to find the 5 different module types
(yes, there is a chance that you won't find all 5, but that's a small chance, and all you have to do is loop back and get a dozen more when that happens)
Bookmarks