From: Peter Brawley Date: January 11 2006 8:03pm Subject: Re: Problem using IN statement MySQL 5 List-Archive: http://lists.mysql.com/mysql/193782 Message-Id: <43C5649F.8010401@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Paul, SELECT * from encore enc, article art WHERE enc.encore_id= '10' AND `article_id` IN (`articles`) First, IN() accepts either a literal value list, or a subquery which returns a value list. Just passing it a table name won't work. Second, your join looks suspicious. Is this what you mean?... SELECT * FROM encore AS enc INNER JOIN article AS art USING (article_id) WHERE enc.encore_id= 10; PB ----- Paul Nowosielski wrote: >Hello, > >I'm trying to run q query with an IN statement in MySQL 5. Like so: > >SELECT * from encore enc, article art >WHERE enc.encore_id= '10' AND `article_id` IN (`articles`) > >Its should return all the articles in the encore.articles column but >instead only returns the first article. > >In encore,articles is the data 43,44,45,46. >These are article IDs. If I manually place 43,44,45,46 into the query >like so: > >SELECT * from encore enc, article art >WHERE enc.encore_id= '10' AND `article_id` IN (43,44,45,46) > >All 4 articles are returned. Any ideas why this is not working? > >TIA! > > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.17/226 - Release Date: 1/10/2006