sql:left join查询可能出现重复数据 (主表中一条变两条)

创建两个表 

 

执行下列查询语句

SELECT * from person a LEFT JOIN people b on a.action_id = b.action_id

显然 person表中的数据出现了两次 ,left join 以主表为主 ,我们在今后的开发要注意类似的问题

执行下面的语句也是同样的效果

SELECT * from person  a ,people b where a.action_id = b.action_id
 

参考:https://blog.csdn.net/qq_16605855/article/details/62890320

猜你喜欢

转载自blog.csdn.net/weixin_38750084/article/details/88079037