Checking if a mysql row is NOT in an array
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
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)
精彩评论