XP is just a number | |
PerlMonks |
Re: Re: Re: Re: Is there a good way of retrieving entries randomly from a database (MySQL perhaps)?by soon_j (Scribe) |
on Jan 04, 2004 at 09:10 UTC ( [id://318640]=note: print w/replies, xml ) | Need Help?? |
Just re-writing it, with a bit of correction (not a syntax type): SELECT ques_id FROM questions q, categories c WHERE q.category_id = c.category_id AND subject = 'Mathematics' AND category in ('Calculus', 'Geometry', 'Algebra') ORDER BY RAND() LIMIT 1 The above query is for the subject 'Mathematics' only. How about for the other subjects? I am try to avoid repeating the above query for the next subject like Astronomy perhaps. I am try to consolidate all these tiny queries for each subject into a single and systematic query. Thanks! Jay
In Section
Seekers of Perl Wisdom
|
|