我有一个表,例如,一个列 id_type 和另一个列 num_area。我想搜索 num_area 的值与特定值不匹配的所有 id_type。
id_type num_area
---- ----
1 121
2 121
1 95
3 47
4 65
例如,如果我想要没有 num_area 121 的 id_type,它会返回我,id_type 3 和 4。
谢谢
最佳答案
计划
- list id_type where num_area is 121
- list distinct id_type not in above
查询
select distinct id_type
from example
where id_type not in
(
select id_type
from example
where num_area = 121
)
;
输出
+---------+
| id_type |
+---------+
| 3 |
| 4 |
+---------+
关于mysql - SQL : Select row where a column of this row does't match with a certain value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32818991/