mysql join on 可以带and,例如:
select * from (select id,realname from `user` where id=157) a left join `crm_customer2user` cu on a.id=cu.userId and cu.customerType='A'
用于将被join表没有对应数据的时候也可以将主join表的数据显示出来
select * from (select id,realname from `user` where id=157) a left join `crm_customer2user` cu on a.id=cu.userId and cu.customerType='A'
用于将被join表没有对应数据的时候也可以将主join表的数据显示出来
本文介绍了MySQL中如何使用JOIN ON子句,并展示了如何在ON条件中加入AND操作符来实现更复杂的连接逻辑。通过示例说明了左连接(left join)的应用场景,即即使被连接表中没有对应记录也能返回主表中的数据。
1999

被折叠的 条评论
为什么被折叠?



