详细解释mysql in 和 not in 语句用法
网络整理 - 06-27
mysql in 和not in语句的用法实例:
1.mysql in语句
select * from tb_name where id in (10,12,15,16);
2.mysql not in 语句
select * from tb_name where not id in (21,22,23);
3.mysql in not in 一起使用
select * from tb_name where id in (10,12,15,16) and not id in (21,22,23);
特别注意:mysql 中的not in语句,别少了列名(本例中是id)在其中,否则会报语法错误。