问题标签 [notin]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
78 浏览

mysql - 将 NOT IN 查询转换为更好的性能

我使用的是 MySQL 5.0,我需要微调这个查询。谁能告诉我在这方面我能做些什么调整?

0 投票
4 回答
52 浏览

sql - SQL - 澄清Between and NOT IN Combo

如果这是一个 n00b 问题,我对 SQL 有点陌生,所以请多多包涵。所以我的代码运行类似于以下内容:

阅读它,它似乎检查“余额”。“代码值”在 A 和 Z 之间或在 'ABCDEFG' 中,而不是在 'XYZ'、'1234'、'Etc' 或 A 和 Z 之间。不是 A 和 Z 的两个检查相互抵消了吗?

提前感谢您的帮助。

0 投票
2 回答
343 浏览

mysql - 如何在 MySQL 查询中为 NOT IN 子句指定命名参数值?

我编写了以下 SQL 查询:

但是,由于出现以下错误,我似乎无法正确获取“NOT IN”子句中命名参数的语法:

如果有人能指出我正确的方向,我真的很感激。

0 投票
2 回答
97 浏览

mysql - 从 NOT IN 中选择 - 除外

我有两个相关的表。其中一个表包含照片的每个条目,另一个包含每张照片和用户信息的所有猫条目。

相片

每张照片都可以为每个用户分配到更多类别

我想要的是为用户 40000 选择所有未包含在“P”猫中的照片,即使它们可能已包含在“A”或“B”猫中。

因为 photo2.jpg 包含在 P cat 中,所以不应该出现在搜索结果中。我对用户 40000 的查询应给出以下结果:

0 投票
1 回答
37 浏览

sql-server - Missing data row in NOT IN clause

I just realised that my Auto-Price Calculation doesn't fill the Prices for ListID 4. I inserted the Prices from the SELECT shown below.

For bugg research I executed the SELECT without the WHERE part and it shows me the example data row.

I can't find the error though, why it is not shown in the complete select (it has no entry with ListID = 4).

Someone can see my mistake?

Not In Error

Edit: Just tried the subselect alone, it shows no rows for the requested article. Why is the NOT IN clause unaffected by this fact? subselect

0 投票
1 回答
16 浏览

notin - div里面的复选框是checke还是不是?

我有两列,一列用于用户(包括学生和教师),另一列用于教师订阅。我想选择当前用户(例如 user1)没有关注的用户(教师)。

我试过这个..

select users.uid,acctype,uname from users where uid!=1 && acctype='Teacher'&& users.uid not in (select tid from teacher_subscription where uid!=1&&tid!=users.uid)

但没有得到渴望的结果

我有两列,一列用于用户(包括学生和教师),另一列用于教师订阅。我想选择当前用户(例如 user1)没有关注的用户(教师)。

我试过这个..

select users.uid,acctype,uname from users where uid!=1 && acctype='Teacher'&& users.uid not in (select tid from teacher_subscription where uid!=1&&tid!=users.uid)

但没有得到渴望的结果

0 投票
4 回答
157382 浏览

python - python - 如果不在列表中

我有两个清单:

我必须使用一些我继承的代码,如下所示:

如何使用上面的代码告诉我“公民”不在 mylist 中

这本来是理想的方法,但我不能使用它,不要问我为什么。

结果:

0 投票
1 回答
19 浏览

mysql - 如何从查询中省略一些结果但不是全部

假设我有一个表,其中包含一个名为 foo 的字段。Foo 是一个字符字段。我想返回 foo 所在的所有记录:

  1. 不在 ('ad','ca','qw')
  2. 不像 '9%' 除非是 '96321'

这是我所拥有的,但我正在尝试如何获得“96321”

0 投票
1 回答
407 浏览

mysql - MySQL - 替换 LEFT JOIN 代替 NOT IN

在三个表之间有两个 LEFT JOIN 的正确 MySQL 查询是什么?

就像是

0 投票
4 回答
538 浏览

sql - 如何避免在 SQL Server 中重复插入动态值

我想编写一个查询来插入动态值,如果它们已经存在或不存在。到目前为止,我已经尝试过了。

但这仅返回上选择(表中已存在)。我究竟做错了什么?