两表连接查询问题

willalwaysbeyou 2018-12-30 09:17:03
表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语句应该怎么写哇?
...全文
41 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
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
willalwaysbeyou 2018-12-31
  • 打赏
  • 举报
回复
嘿嘿搞定了谢谢

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧