码迷,mamicode.com
首页 > 数据库 > 详细

sql: left join vs. not in

时间:2018-10-22 16:43:45      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:name   from   username   结果   login   join   where   product   info   

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

标签:name   from   username   结果   login   join   where   product   info   

原文地址:https://www.cnblogs.com/printk/p/9830510.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!