mysql加入3张表 [英] mysql join 3 tables

查看:105
本文介绍了mysql加入3张表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何连接具有一个公用列(id)的三个mysql表,例如,从Table1中选择a,b,从table2中选择c,d,从table3中选择e,f,其中id = x 谢谢

How can I join three mysql tables which have one common column (id), For example, Select a, b from Table1, select c,d from table2, select e,f from table3, where id=x Thanks

推荐答案

 SELECT t1.a, t1.b, t2.c, t2.d, t3.e, t3.f
  FROM table1 t1
  JOIN table2 t2 ON (t1.id = t2.id) 
  JOIN table3 t3 ON (t1.id = t3.id)
  ORDER BY t1.id;

这篇关于mysql加入3张表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆