Jump to content

quick help


Monkuar

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

  Quote

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.