当前位置:Gxlcms > 数据库问题 > mysql连表查询

mysql连表查询

时间:2021-07-01 10:21:17 帮助过:25人阅读

 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也会返回

 

 

mysql连表查询

标签:连接   where   sql   join   select   也会   外连接   返回   null   

人气教程排行