Re: Simplifying MySql queries

From: Date: Sat, 12 Feb 2011 21:44:51 +0000
Subject: Re: Simplifying MySql queries
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-311261@lists.php.net to get a copy of this message
Andre Polykanine wrote:
and here goes the question: is there a way to make these four in one so strictly one random question is selected from all of the four categories?
"SELECT * FROM CandidateQuestions WHERE Category IN(1,2,3,4) ORDER BY RAND() LIMIT 4" note the limit 4, you'll be needing that to get back 4 rather than 1 :)

« previous php.general (#311261) next »