dreamwest Posted December 4, 2010 Share Posted December 4, 2010 I have a simple select but it wont return the values i need, maybe someone can tell me why its doing this: Table 1: v_id v_word 70 south 69 park 68 brub 67 brrub 66 brrrrub! Table2: l_id l_word_id l_vid_id 70 70,69,68,67,66 834785 SELECT * FROM `vid_loc` AS l, vid_words AS v WHERE MATCH v.v_word AGAINST ('south park' IN BOOLEAN MODE) AND v.v_id IN (l_word_id) GROUP BY v.v_id This returns: l_id l_word_id l_vid_id v_id v_word 70 70,69,68,67,66 834785 70 south but this selects the two rows i need: SELECT * FROM `vid_loc` AS l, vid_words AS v WHERE MATCH v.v_word AGAINST ('south park' IN BOOLEAN MODE) AND v.v_id IN (70,69,68,67,66) GROUP BY v.v_id This returns: l_id l_word_id l_vid_id v_id v_word 70 70,69,68,67,66 834785 69 park 70 70,69,68,67,66 834785 70 south So the question is: IN (l_word_id) and IN (70,69,68,67,66) both have the same value but why do they return different results? Quote Link to comment https://forums.phpfreaks.com/topic/220620-select-in/ Share on other sites More sharing options...
fenway Posted December 5, 2010 Share Posted December 5, 2010 That's because "l_word_id" is a SINGLE string literal value, not a list. Quote Link to comment https://forums.phpfreaks.com/topic/220620-select-in/#findComment-1143285 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.