a表 b表
a.id同parent_id 存在关系
----------------------------------------------------------------------------------------------------------
1)内连接:相当于select a.*,b.* from a,b where a.id = b.id
select a.*,b.* from a inner join b on a.id=b.parent_id
结果是
----------------------------------------------------------------------------------------------------------
2)左连接:左表的挨个信息去查询,查不到则将右边控制为null进行显示
select a.*,b.* from a left join b on a.id=b.parent_id
结果是
----------------------------------------------------------------------------------------------------------
3) 右连接:右表的挨个信息去查询,查不到则将左边控制为null进行显示
select a.*,b.* from a right join b on a.id=b.parent_id
结果是
----------------------------------------------------------------------------------------------------------
4) 完全连接: MySQL暂不支持完全连接
----------------------------------------------------------------------------------------------------------
区分:
select * from a left join b on 条件1
select * from a left join b on 条件1 where 条件2 相当于再次过滤