表A
id a b c d
1 2 3 4 5
2 3 4 3 1
表B
id a b c e
0 2 3 4 6
1 3 4 3 2
1 2 3 4 7
想要得到表
id a b c d e
0 2 3 4 0 6
1 3 4 3 0 2
2 3 4 3 1 0
1 2 3 4 7 5
的mysql语句应该怎么写哇?
...全文
412打赏收藏
两表连接查询问题
表A id a b c d 1 2 3 4 5 2 3 4 3 1 表B id a b c e 0 2 3 4 6 1 3 4 3 2 1 2 3 4 7 想要得到表 id a b c d e 0 2 3 4 0 6 1 3 4 3 0 2 2 3 4 3 1 0 1 2 3 4 7 5 的mysql语句应该怎么写哇?
select if(t1.id is null,t2.id,t1.id) as iid,t1.a,t1.b,t1.c,if(t1.d is null,0,t1.d)as ddd,if(t2.e is null,0,t2.e)as eee from t1 full out join t2
on t1.a=t2.a and t1.b=t2.b and t1.c=t2.c