gpt4 book ai didi

mysql - 选择与内连接条件不匹配的行

转载 作者:行者123 更新时间:2023-11-29 03:07:35 25 4
gpt4 key购买 nike

我有两个表,一个包含大量链接 (tvlinks),另一个包含要与链接名称 (tvshows) 匹配的子字符串列表:

tvlinks:
id (int 11) - primary index key
name (text) - name of the tv show link
link (text) - link to a website with information about the tv show

tvshows:
id (int 11) - primary index key
name (text) - name of the tv show
match (text) - substring to be matched against name in tvlinks table

tvlinks 中可以有多行具有完全相同的名称和不同的链接。没有重复的行。

我使用以下查询从 tvlinks 中获取所有行,其中 tvshows.match 是 tvlinks.name 的子字符串:

SELECT l.id,
l.name,
l.link
FROM tvlinks tvl
INNER JOIN tvshows tvs
ON ( INSTR(tvl.name, tvs.match )
ORDER BY tvl.name
;

它工作正常,我的问题是我想组合另一个查询,它只返回与上面的查询不匹配的行。

我已经断断续续地敲击键盘一两个星期了,我确信它非常简单,但我在很大程度上错过了。 :)

谢谢你的帮助

最佳答案

从 id 不在的 tvlinks 中选择 id(选择 l.id,
来自 tvlinks tvl
INNER JOIN 电视节目电视
ON ( INSTR(tvl.name, tvs.match)
按 tvl.name 排序
;)

本身效率不高,全看你的表。

关于mysql - 选择与内连接条件不匹配的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13112701/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com