Mysql “的对立面”;“在哪里?”;

Mysql “的对立面”;“在哪里?”;,mysql,Mysql,我想问一下,是否存在一个与WHERE IN相反的命令,我想选择一个数组中具有不同pamater的所有行 <?php $data = array(1,2,3); // normal query $query = "SELECT * FROM table_1 WHERE id <> 1 && id <> 2 && id <> 3"; // how can i do the same query passing an a

我想问一下,是否存在一个与WHERE IN相反的命令,我想选择一个数组中具有不同pamater的所有行

<?php
 $data = array(1,2,3);
 // normal query
 $query = "SELECT * FROM table_1 WHERE id <> 1 && id <> 2 && id <> 3";
 // how can i do the same query passing an array?

?>

是,
不在

SELECT * FROM table_1 
WHERE id NOT IN (1,2,3)

在SQL中进行任何验证之前,始终可以使用
NOT
,以获得相反的结果

在您的情况下,它将是:

SELECT * 
FROM table_1 
WHERE id NOT IN (1,2,3);

其中ID不在(1,2,3)
?oO Try
EXISTS()
也应返回
notexists()
是否应返回
NULL
值?