与 SQL 中的 IN 运算符相反 [英] Opposite of IN operator in SQL

查看:32
本文介绍了与 SQL 中的 IN 运算符相反的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能做相反的事情:

How could I do the opposite of:

换句话说,选择所有姓氏不是 Hansen 或 Pettersen 的人.

In other words select all the people whose last name is NOT Hansen or Pettersen.

推荐答案

WHERE lastname NOT IN ('Hansen', 'Pettersen')

请参阅SQLite 所理解的SQL中的IN 和NOT IN 运算符"部分

see the section "The IN and NOT IN operators" in SQL As Understood By SQLite

这篇关于与 SQL 中的 IN 运算符相反的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆