八个表如何在sql server 2008r2中使用连接? [英] how Eight tables using joins in sql server 2008r2?

查看:116
本文介绍了八个表如何在sql server 2008r2中使用连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有



我在sql server中创建了8个表如何使用加入这8个表,是否有可能请回复我

解决方案

是的,这是可能的,但它可能会变得难以处理。点击此处了解详情:内部联接多表 [ ^ ]


< blockquote>只要您知道哪些列与哪些列相关并因此匹配,就可以。



这是3个表的示例查询:



 < span class =code-keyword> SELECT  p.Name,v.Name 
FROM Production.Product p
JOIN Purchasing.ProductVendor pv
ON p.ProductID = pv.ProductID
JOIN Purchasing.Vendor v
ON pv.BusinessEntityID = v.BusinessEntityID
WHERE ProductSubcategoryID = 15
ORDER BY v.Name;





[请鼓励通过投票解决方案或答案参与这对你有用]


Dear all

I created 8 tables in sql server how use joins these 8 tables, is possible or not please reply me

解决方案

Yes, it is possible, but it can become unwieldy complex. Learn more here: inner-join-with-multiple-tables[^]


It is possible as long as you know which columns from which all tables are related and hence to be matched.

Here is an example query for 3 tables:

SELECT p.Name, v.Name
FROM Production.Product p
JOIN Purchasing.ProductVendor pv
ON p.ProductID = pv.ProductID
JOIN Purchasing.Vendor v
ON pv.BusinessEntityID = v.BusinessEntityID
WHERE ProductSubcategoryID = 15
ORDER BY v.Name;



[Please encourage participation by up-voting solutions or answers that work for you]


这篇关于八个表如何在sql server 2008r2中使用连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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