开发者

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜