php - IN operator only returns if parameter is a specific value -
i have questions table (that contains questions) , tags table (that contains tags (represented integers) each question).
what trying list of questions have same tag in in
operator.
however, query returns questions if 1
there , 0 if isn't there. doesn't return questions tag integer matches in
operator.
here sqlfiddle: http://sqlfiddle.com/#!2/c2ded3/2
it seems id
in id = questions_tags.q_id
somehow ambiguous. if more specific, succeeds:
select id questions exists ( select 1 questions_tags questions.id = questions_tags.q_id , questions_tags.t_id in (1) );
Comments
Post a Comment