List:General Discussion« Previous MessageNext Message »
From:Dan Rossi Date:December 29 2005 2:56am
Subject:issue with subquery
View as plain text  
Hi, im having some issues with a sub query in mysql5 , i have a field 
which is storing a static comma seperate list of primary keys ie 
1,2,3,4 , i am then trying to use that to find entries in another table 
of the same primary keys here is the sql

SELECT count(*) FROM feeds WHERE feedID IN (SELECT feeds FROM 
month_totals WHERE customerID=9 AND month_unique=1105)

expected result should be 4 , i get 1. If i manually put in

SELECT count(*) FROM feeds WHERE feedID IN (1,2,3,4)

for instance i get 4

querying

SELECT feeds FROM month_totals WHERE customerID=9 AND month_unique=1105

gives me 1,2,3,4 , what seems to be the problem ?

Thread
issue with subqueryDan Rossi29 Dec
  • Re: issue with subqueryPeter Brawley29 Dec
  • Re: issue with subqueryJoerg Bruehe29 Dec