为什么只合并第一条记录(比如左表的a1 合并后两行null ,右表的b2,两行null);
如果左侧e5 两个记录,右侧e5 三个记录,你要合并为几条记录?
还是不会出现这种情况,如果是,为什么不会出现这种情况
一般的逻辑是全连接查询
返回结果数为,左表*右表,比如a1 有3*1=3条记录,b2有1*3=3条记录,e5有2*3=6条记录
select a.user_name, a.mobile, a.`password`,b.num, b.seal from table_a a LEFT JOIN table_b b
on a.user_name = b.user_name
UNION
select a.user_name, a.mobile, a.`password`,b.num, b.seal from table_b b LEFT JOIN table_a a
on a.user_name = b.user_name