创建连接别名 - 如何?
我想做类似的事情
SELECT
t.subtitle
FROM
temp t
LEFT JOIN ep e ON e.subtitle=t.subtitle AND e.episode=t.episode AS se
WHERE se IS NULL
GROUP BY t.subtitle, t.episode;
以便 where 子句可以引用左连接的结果,这可能吗还是我必须使用不同的方法? (剧集和字幕在两个表中都有索引)
谢谢, Paul
更新 当我说结果时,我的意思是左表未返回 e.subtitle=t.subtitle 和 e.episode=t.episode 的匹配项,
我是否必须这样做
SELECT
t.subtitle
FROM
temp t
LEFT JOIN ep e ON e.subtitle=t.subtitle AND e.episode=t.episode
WHERE e.subtitle IS NULL AND e.episode IS NULL
GROUP BY t.subtitle, t.episode;
I'm wanting to do something like
SELECT
t.subtitle
FROM
temp t
LEFT JOIN ep e ON e.subtitle=t.subtitle AND e.episode=t.episode AS se
WHERE se IS NULL
GROUP BY t.subtitle, t.episode;
So that the where clause can refer to the result of the left join, is this possible or do I have to use a different method? (episode and subtitle are indexed in both tables)
Thanks,
Paul
UPDATE When I say result I mean the left table returns no matches for e.subtitle=t.subtitle and e.episode=t.episode
Do I have to instead do
SELECT
t.subtitle
FROM
temp t
LEFT JOIN ep e ON e.subtitle=t.subtitle AND e.episode=t.episode
WHERE e.subtitle IS NULL AND e.episode IS NULL
GROUP BY t.subtitle, t.episode;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您必须对结果进行第二次查询:)
Yes, you'll have to do that second query for the result :)