开发者

Real left outer join

开发者 https://www.devze.com 2023-03-25 18:04 出处:网络
How do I perform a real left outer join in mysql? it seems it\'s left outer join includes the inner join. I need to find records in table a that are not in table b.

How do I perform a real left outer join in mysql? it seems it's left outer join includes the inner join. I need to find records in table a that are not in table b.

The best I could come up with is

select * from `a` where `a`.`index` not in (select `index` from `b`)

Is there any more optimized 开发者_运维问答way? without subquery maybe?


This is how you would do it w/ a left join:

select * 
from `a`
left outer join `b`
on `a`.`index` = `b`.`index`
where `b`.`index` is null
0

精彩评论

暂无评论...
验证码 换一张
取 消