MySQL Join 和内部选择
我目前有一个疑问
SELECT id FROM table1 WHERE {filters on table1} AND id NOT IN (SELECT table1ID FROM table2 WHERE 条件 = 0)
Table1 与 table2 具有 1 - Many 关系,我正在查找 table2 中没有条件条目的所有 ID =0。
有没有办法在没有内部选择的情况下重写这个查询?我已经为此摸不着头脑有一段时间了,欢迎任何指点。
I currently have a query
SELECT id FROM table1 WHERE {filters on table1} AND id NOT IN (SELECT table1ID FROM table2 WHERE condition = 0)
Table1 has a 1 - Many relationship with table2 and I'm looking for all the IDs that have no entries in table2 with condition=0.
Is there any way to rewrite this query without the inner select? I'm been scratching my head about it for a while now and any pointers would be welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以尝试类似的东西
或者 一样好
You can try something like
Or just as good would be