Re: Selecting Rows Based on Row Values Being in Array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry,
That was a typo there's on one IN clause.
here is how it reads: SELECT * FROM central WHERE 
CONCAT(strName,strCity,strState) IN('7orange50lbs','8purple60lbs').

So in my table I have 8 in size column, purple in color column, and 60lbs in 
weight column.

Since the concatenated value will be 8purple60lbs, shouldn't MySQL return 
that row?  Thanks for your patience.

"Jim Lucas" <lists@xxxxxxxxx> wrote in message 
news:468C9C97.7080100@xxxxxxxxxxxx
> kvigor wrote:
>>>> where is the part that it join()'s things together?
>> it's: $in_list = "'".join("','",$list)."'";
> Good
>
>>
>>>> what is the output of the join() call
>> it's: '7orange50lbs','8purple60lbs' //once echo'd
> Fine
>
>>
>>
>> $query_One = "SELECT * FROM shoe WHERE CONCAT(size,color,weight) 
>> IN({$in_list})";
>>
>> This is the results of $query_One:
>>
>> PHP echo returns:
>> SELECT * FROM shoe WHERE CONCAT(size,color,weight) 
>> IN('7orange50lbs','8purple60lbs)
>>
>>
>> MySQL returns:
>> MySQL returned an empty result set (i.e. zero rows). (Query took 0.0008 
>> sec)
>> SQL query:
>> SELECT *
>> FROM shoe
>> WHERE CONCAT( size, color, weight )
>> IN (SELECT * FROM shoe WHERE CONCAT(size,color,weight) 
>> IN('7orange50lbs','8purple60lbs')
>
> ???
>
> What is wrong with the above statement?
>
> This should be an easy one for you to figure out?
>
>
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
>
> Give up?
>
> Well, looks like you are inserting the sql statement inside it self
>
> It should look like this
>
> SELECT *
> FROM shoe
> WHERE CONCAT( size, color, weight ) IN('7orange50lbs','8purple60lbs')
>
>
> not
>
> SELECT *
> FROM shoe
> WHERE CONCAT( size, color, weight )
> IN (SELECT * FROM shoe WHERE CONCAT(size,color,weight)
> IN('7orange50lbs','8purple60lbs')
>
> Notice the sub-select???
>
> Find where you are inserting the SQL into itself and remove it, and you 
> might have the answer to your problems.
>
> Jim 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux