Jump to content

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/255199-quick-help/#findComment-1308454
Share on other sites

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 :)

Link to comment
https://forums.phpfreaks.com/topic/255199-quick-help/#findComment-1308455
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.