sql: left join vs. not in

Posted printk

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql: left join vs. not in相关的知识,希望对你有一定的参考价值。

select * from product.login_info where username not in (select username from stat.totaluser)

vs.

select a.* from product.login_info as a left join stat.totaluser as b on a.username = b.username where b.username is null

上面2条sql语句的执行结果集是一样的

以上是关于sql: left join vs. not in的主要内容,如果未能解决你的问题,请参考以下文章