Randomization by Table Integer
Posted 25 July 2006 - 07:52 PM
Well basically I have a problem.
I have a table with a value: Popularity. What I want to do is do a site randomization.
I have rows: id, url, website_description, popularity
What I want to do is do a randomization where a site will come up in the script by a popularity number of 1 to 100(or more).
My problem is I have seen plenty of randomization scripts out there but nothing this complex.
Wondering if someone knows a way to do this. I want it to randomize all sites but those sites that have the highest popularity rating would show up more then the sites with the lowest.
Any help you can give me would be great!
Thanks for reading
Posted 26 July 2006 - 12:17 PM
Complex? Sounds like you want to pull N random records from your table, and then sort by the popularity field. What's the problem?
Complex to me because I do not know how to do that. And problem is I am such a newbie that I do not know how I would do it. Thus my reason for asking if someone knew.
Posted 26 July 2006 - 03:34 PM
SELECT id, url, website_description, popularity FROM yourTable WHERE id IN ( SELECT id FROM yourTable ORDER BY RAND() LIMIT 5 ) ORDER BY popularity DESC
I didn't mean that you're question wasn't valid, just that the problem were you describing wasn't complex.
Posted 26 July 2006 - 06:07 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users