发表于 2018-11-26 19:37:52 by 月小升
数据库users
id email cookie status
1 a@java-er.com aa 2
2 f@java-er.com bb null
3 b@java-er.com cc 1
4 d@java-er.com dd 3
select * from users where status not in (1,3) |
select * from users where status not in (1,3)
第二条记录不出来
所以要改成
select * from users where (status not in (1,3) or status is null) |
select * from users where (status not in (1,3) or status is null)
in不受影响
select * from users where status in (1,3) |
select * from users where status in (1,3)
This entry was posted in
数据库 and tagged
mysql. Bookmark the
permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:
月小升博客 –
https://java-er.com/blog/mysql-not-in-null/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力.