You could also use OR

select id, title from content where id = 100 or id =106;


Brian


From: "Quentin Bennett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>,<mysql@lists.mysql.com>
Subject: RE: select random ids from list
Date: Tue, 1 Aug 2006 14:59:14 +1200

If you know the list of Ids, try

select id, title from content where id in (100, 106, 109);

If you want the list to be random, then you can use the RAND() function.

Quentin

-----Original Message-----
From: kalin mintchev [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 1 August 2006 2:10 p.m.
To: mysql@lists.mysql.com
Subject: select random ids from list



 hi all...

 how can i do a query on a list of ids without doing individual queries
for each one of them?

 something like:
 select id,title from content where id = 100,106,109;

 of course this doesn't work...  is it possible somehow?


 thanks....




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
The information contained in this email is privileged and confidential and
intended for the addressee only. If you are not the intended recipient, you
are asked to respect that confidentiality and not disclose, copy or make use
of its contents. If received in error you are asked to destroy this email
and contact the sender immediately. Your assistance is appreciated.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]


_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to