我有 2 个表需要对其运行查询
Table1 has 2 fields: l_id, and name
Table2 also has 2 fields: l_id, and b_id
我需要运行一个查询来获取表 1 中所有条目的“名称”和“l_id”,这些条目在表 2 中没有对应给定 b_id 的条目。
希望这是有道理的
最佳答案
select t1.*
from Table1 t1
left outer join Table2 t2 on t1.l_id = t2.l_id
and t2.b_id = @SomeValue
where t2.l_id is null
关于mySQL 外连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3918690/