Monkuar Posted January 17, 2012 Share Posted January 17, 2012 what does WHERE p.pid IN(0,4561,0) mean? I know it's lokoing for DATA FROM p.pid = 4561, but WHAT THE HELL DOES THE 0, ,0 mean? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/255199-quick-help/ Share on other sites More sharing options...
RussellReal Posted January 17, 2012 Share Posted January 17, 2012 IN is sort of an "IS IN" Understanding the WHERE clause.. WHERE is basically IF statements that are compared against the rows in the table.. WHERE 1 = 1 is a valid where clause, because when you do WHERE id = 17 its basically evaluating the >>id<< and then comparing the two values which would look something like: WHERE 47 = 17 now, the IN clause, basically is looking for VALUE in VALUESET for example WHERE id IN (1,2,3) that code would be evaluated and look like this: WHERE 177 IN (1,2,3) and would be false, therefore the row will not be taken why would it be false? because 177 is not equal to 1 OR 2 OR 3 so what your IN clause is looking for.. WHERE 177 = 0 OR 177 = 4561 OR 177 = 0 which makes no sense, which is why I gave you a more in depth explanation Quote Link to comment https://forums.phpfreaks.com/topic/255199-quick-help/#findComment-1308454 Share on other sites More sharing options...
Monkuar Posted January 17, 2012 Author Share Posted January 17, 2012 IN is sort of an "IS IN" Understanding the WHERE clause.. WHERE is basically IF statements that are compared against the rows in the table.. WHERE 1 = 1 is a valid where clause, because when you do WHERE id = 17 its basically evaluating the >>id<< and then comparing the two values which would look something like: beautiful topic solved WHERE 47 = 17 now, the IN clause, basically is looking for VALUE in VALUESET for example WHERE id IN (1,2,3) that code would be evaluated and look like this: WHERE 177 IN (1,2,3) and would be false, therefore the row will not be taken why would it be false? because 177 is not equal to 1 OR 2 OR 3 so what your IN clause is looking for.. WHERE 177 = 0 OR 177 = 4561 OR 177 = 0 which makes no sense, which is why I gave you a more in depth explanation Quote Link to comment https://forums.phpfreaks.com/topic/255199-quick-help/#findComment-1308455 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.