如何在SQL Server 2008中联接两个表? [英] How to join two tables in sql server 2008?
本文介绍了如何在SQL Server 2008中联接两个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在sql server 2008中联接两个表?
谁能告诉我逐步的过程!
How to join two tables in sql server 2008?
can any one tell me step by step process!!
推荐答案
UsersTable UserRolesTable
PK user_id PK user_role_id
FK user_role_id role_description
username
password
SELECT A.username, B.role_description
FROM UsersTabel A
INNER JOIN UserRolesTable B
ON A.user_role_id = B.user_role_id
通过这个非常简单的示例,希望您能理解;)
之后,移至更高级的那一步.请参阅下面的链接.
SQL联接的可视表示形式 [
Thru that very simple example, hope you get it ;)
After that, move to the more advance one. See link below.
Visual Representation of SQL Joins[^]
Regards,
Eduard
与
相似 您想要哪个加入?
same like
which join you want?
SELECT order_id, product_name, unit_price, supplier_name, total_units
FROM product, order_items
WHERE order_items.product_id = product.product_id;
或其他语法
or another Syntax
SELECT column_name(s)
FROM table_name1
INNER JOIN table_name2
ON table_name1.column_name=table_name2.column_name
看看以下内容:
http://www.dotnetspider.com/resources/635-SQL-Joins-wi- Examples.aspx [ ^ ]
http://www.w3schools.com/sql/sql_join_left.asp [ http://www.gplivna.eu/papers/sql_join_types.htm [
have a look at the following:
http://www.dotnetspider.com/resources/635-SQL-Joins-wi-Examples.aspx[^]
http://www.w3schools.com/sql/sql_join_left.asp[^]
http://www.gplivna.eu/papers/sql_join_types.htm[^]
这篇关于如何在SQL Server 2008中联接两个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文