mysql查询获取所有数字,不包括两个类型if字段

时间:2016-03-30 10:28:25

标签: mysql

有mdn,cir,pid,status的mysql表 我想找到所有不在x和Y cir中的mdn,使用PID作为Z ..不要使用子查询或多个查询。

this is what i have tried but it is giving me wrong answer  :

select * from tbl where (cir not in ('X','Y') && PID not in ('Z')) ;

1 个答案:

答案 0 :(得分:0)

如果我理解你,你想要所有人,不包括cir in('x','y') + pid = 'z' 在一起的行,而不是每个人分别如此:

select * from tbl
where NOT(cir in ('X','Y') AND PID ='Z') ;