问题标签 [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 投票
1 回答
549 浏览

mysql - MySQL修剪(连接...)

这个查询有什么问题?

目标是仅提取不存在 Source、Source_Description 和 URL 组合的记录(在我的情况下是这样)。但是,如果它只在一个列中看到匹配项,它会忽略它。

MySQL新手......如果有更好的方法来处理这个查询,我将不胜感激。

0 投票
1 回答
1432 浏览

mysql - MySql,CONCAT 和 NOT IN,字符串值

我有这样的查询,但它没有选择任何东西,但它应该。所以查询

我用 null 和 '1sfgsg' 值手动添加到表条目,但它没有被选中。为什么?我需要选择所有 concat 值不在数组中的条目。帮助处理它。

0 投票
3 回答
69 浏览

mysql - 多对多关系过滤器

我有以下表格:

现在假设我们有 id 为 1、2、3、4、5 的用户

并且user_id = 1已经关注用户 2 和 3。

现在我想写一个查询,给我user_id's(user_id = 1)不关注的(4 和 5)。

有人可以帮忙吗。

0 投票
1 回答
180 浏览

mysql - Mysql条件不起作用

这是我获取特定日期订单总额的查询。在这里,使用 AND (tos.status!='5' 或 tos.status!='6') 时我无法得到正确的结果。这有什么问题?

0 投票
2 回答
83 浏览

php - 使用 NOT IN 从其他表中排序的 sql 语句

我正在为一个班级设计一个简单的微博网站,需要一些关于滚动分页的 sql 语句的帮助。

我有 2 个表:用户和关注。

在我的“用户”表中,我有 uid、FirstName、LastName、Email 和 Username。

我有另一个“Follows”表,其中包含了 rid、FollowedName 和 FollowName。

例如,如果用户名“Alex”跟随用户名“Bob”,那么将存在一个新行,其中 FollowedName="Bob" 和 FollowName="Alex"。

对于搜索页面,我允许用户根据受欢迎程度(基于关注者的数量)进行排序。所以我需要一个 SQL 语句,它将从“用户”中选择所有行,然后根据每个用户在“关注”表中的条目数对它们进行排序。

最重要的是,我需要该语句来过滤掉那些 uid 在字符串名称 $explodedids 中的用户。

我一切正常,但我不知道该把"WHERE uid NOT IN (".$explodedids.")".

这是我的声明,它正确返回但没有过滤掉 $explodedids:

$postnumbers 只是我滚动分页的限制数。我确信我只是把 WHERE NOT IN 放在了错误的地方,但如果你们能帮助我,那就太棒了。

0 投票
3 回答
384 浏览

mysql - 从表中删除记录,如果其特定值未出现在另一个表中

我有两张桌子。T1t1field1t1field2,T2t2field1t2field2. T2如果t2field1值不存在,我想从中删除所有记录t1field1

0 投票
1 回答
105 浏览

php - MySql Delete NOT IN - 但比较整行

这应该比较简单。我翻遍了 MySql 文档,找不到相关信息。

场景很简单。我有一个有 3 列的表。所有都是复合唯一键,因为所有键一起必须是唯一的才能成为有效行。

如何在此设置中使用 DELETE NOT IN?

我试过类似的东西:

如您所见,我想匹配值集,不一定是值本身。

想法?

0 投票
2 回答
1195 浏览

vb.net - Entity Framework query with "not in"

I have a simple (well easy, not simple) query of "not in" on related tables.

In SQL I get the list that I need with remaining items not in the group. Now I want to bind this to a DataGrid using EF5.

I cannot get the query syntax properly (Using VB.net) to list the ID and the Name of the Competency...

Converted the provided c# answer to VB:

Hope this helps someone in the future. Took me about 4 hours to search, ask and convert...

0 投票
2 回答
43 浏览

mysql - How to optimize "WHERE NOT IN" with subquery

I have this query what was discussion output in this thread: Mysql JOIN subquery

See current fiddle: http://sqlfiddle.com/#!2/e97cf/22

How the hell I am going to optimize this query? I have 100.000 records in c_contact table and about 10.000 in c_monitoring table. Query takes > 30 secs with 127 result rows.

EDIT: Case was solved by indexing tables correctly.

0 投票
1 回答
2199 浏览

wordpress - Wordpress 获取不在自定义分类术语中的帖子

以下代码应该获取自定义分类中没有特定术语的帖子。目前它仍然得到他们。是不是缺少了什么。