MySQL join 用法

时间:2017-06-24 15:22:07   收藏:0   阅读:282
select column1, column2 from TABLE1 join TABLE2 on 条件

#
select * from table1 join table2;
#两个表合成一个
select a.*, b.* from a left join b where a.id=b.id limit 0,1;

 

on 条件 where/ group by / having/ 
除了on的条件, 还能加where等条件

 

除了join还有:
left join 左表为准
right join 右表为准
inner join 交集

用法差不多

 

原文:http://www.cnblogs.com/perl6/p/7073382.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!