MySQL联合查询和左关联的区别

我把这个定义为联合查询或者说并查询:

第1种:SELECT a.gbname,b.gcontent FROM tb_goodsbrand a,tb_goods b WHERE a.gbid = b.gbid

结果为:

#========================================================================

我们在用左连接来查询:

第2种:SELECT a.gbname,b.gcontent FROM tb_goodsbrand a LEFT JOIN tb_goods b ON a.gbid = b.gbid

结果就是:

总结:第1种是满足where后面所有的条件,才显示出来;

   第2种是左连接,左边的都显示,右边有就显示,没有的就不显示。

原文地址:https://www.cnblogs.com/wangzn/p/6962077.html