MySQL IN Condition
MySQL IN Condition
Khalid Teli
Posts: 251Questions: 71Answers: 0
Hi,
I have been trying this for few days before reaching out here,
I have an issue where i try to use IN condition in WHERE clause
$editor->where( function ( $q ) use ( $userdetails ) {
$ftype=('chilled','frozen');
OR
$ftype = ["member","creed"]
$q->where( 'food_type', '(SELECT food_type FROM food WHERE food_type = :type)' ,'IN', false );
$q->bind( ':type', $ftype);
} );
I am trying to write this query if the column name (food_type) contains either chilled or frozen , it should show data containing both or either one of these strings.
Thank you
Your help will be appreciated
Answers
Hi,
I tried few solutions and this one works fine. Just wondering if it is the right thing to do:
It is yes. We use something similar in our sub-select example.
Allan