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

MySQL join 用法

时间:2017-06-24 15:34:31      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:span   class   logs   limit   用法   条件   table   sel   code   

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 交集

用法差不多

 

MySQL join 用法

标签:span   class   logs   limit   用法   条件   table   sel   code   

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

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