[英]Simple Joining in SQL Server
I am currently trying to join table 1 and table 2 to get the third table 3 but I am having trouble. 我目前正在尝试将表1和表2连接起来以获取第三个表3,但是遇到了麻烦。 The A and B are similar for each.
A和B彼此相似。 They can be linked by
Company_ID
. 它们可以通过
Company_ID
链接。
Not sure what exactly the problem is, but here's the syntax for performing a simple join on company_id
and assuming you only want a
and b
once: 不知道到底是什么问题,但是这是在
company_id
上执行简单company_id
并假设只需要一次a
和b
的语法:
SELECT t1.a, t1.b, c, d, e, f
FROM t1
JOIN t2 ON t1.company_id = t2.company_id
When I first had to use a join, I found this article by Jeff Atwood very helpful. 当我第一次必须使用联接时,我发现Jeff Atwood的这篇文章很有帮助。
http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/ http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.