如何获得此输出 [英] how to get this output

查看:76
本文介绍了如何获得此输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个表

A,B,C

列id,d,e
B列id,f,g
C列id,h,i


这里id中的三列是相同的

我需要一个ID和三个表信息

输出

id,d,e,f,g,h

如何编写命令

i have three tables

A,B,C

A columns id,d,e
B columns id,f,g
C columns id,h,i


here three columns in id is same

i need one id and three tables information

output

id, d,e,f,g,h

how to write command

推荐答案

您需要加入表.有关教程,请参见 SQL连接 [
You need to join the tables. For tutorial, see SQL Joins[^]

So your statement could be something like
select table1.id, table1.d, table2.f...
from table1 inner join table2 on table1.id = table2.id
            inner join table3 on table2.id = table3.id


您必须使用join.
有关联接的研究.
You have to use join.
Study about joins.


A,B,C

列id,d,e
B列id,f,g
C列id,h,i



从A e选择e.id,e.coloumn1,e.coloumn2,e1.coloumn1,e1.coloumn2,e2.coloumn1,e2.coloumn2加入
e.id = e1.id上的B e1加入e.id = e2.id上的C e2


这里e,e1,e2是table和
的别名 e.coloumn1包含d
e.coloumn2包含e
e1.coloumn1包含f
等等............
A,B,C

A columns id,d,e
B columns id,f,g
C columns id,h,i



select e.id,e.coloumn1,e.coloumn2,e1.coloumn1,e1.coloumn2,e2.coloumn1,e2.coloumn2 from A e join
B e1 on e.id=e1.id join C e2 on e.id=e2.id


Here e,e1,e2 are alises of table and
e.coloumn1 contain d
e.coloumn2 contain e
e1.coloumn1 contain f
etc............


这篇关于如何获得此输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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