mysql连表查询

 select * from test1 a,test2 b where a.no=b.no;;内连接

 select * from test1 a left join test2 b on a.id=b.id;左外连接

  select * from test1 a right join test2 b on a.id=b.id;右外连接(和左连接的区别是左连接是以左边为主表,会把左边为Null也输出,右连接相反) 

内连接和外连接的区别是内连接只匹配符合条件的项,外连接为Null也会返回

 

 

posted @ 2017-02-09 18:08  麦子TMAC  阅读(227)  评论(0编辑  收藏  举报