问题
I know that you can use
WHERE `age` IN ($ages)
to find rows where the column age
equals a part of an array.
But what i need to find out is - What if you want to find rows where age
is NOT in the array??
thanks
回答1:
You need NOT IN
. Yep, it really is that simple.
$ages = "1,3,4,7,9";
// Your SQL WHERE clause...
WHERE `age` NOT IN ($ages)
来源:https://stackoverflow.com/questions/6873734/checking-if-a-mysql-row-is-not-in-an-array