kalin mintchev wrote:
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;
select id,title from content where id IN(10,20,30);
--
MySQL General Mailing List
For list
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:
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
select id,title from content where id IN(10,20,30);
cool thanks.. what if i want it to be random ordering like:
select id,title from content where id IN(20,10,30);
and i would like the order of the ids and the in() to be kept in the
result array. what 'order by' would i use?!
--
MySQL
kalin mintchev wrote:
select id,title from content where id IN(10,20,30);
cool thanks.. what if i want it to be random ordering like:
select id,title from content where id IN(20,10,30);
and i would like the order of the ids and the in() to be kept in the
result array. what 'order by' would