2014-02-27 188 views
0

您好我嘗試從另一個表格的內部連接中選擇數據內部連接(當我沒有例子說出來,這很奇怪,那我爲什麼沒有從Google獲得任何結果)。 這是我的數據庫。SQL從(選擇內部連接)選擇內部連接?

My Database flowchart Picture

我想從表中的product_id的Product_Total即時選擇Product_Total.Product_Name Product_Customer

| Barcode_Id | Product_Name | Sub_Id | Department_Name | Status | 
-------------------------------------------------------------------- 
| KS4815874 | DELL Server | S47811 | Store Main Unit | Spare | 

Select Product_Name inner join Product_Customer.Product_Id = Product.Product_Id then inner join Product.Product_Id_T = Product_Total.Product_Id_T 

,但我怎麼可以在SQL命令

它寫,如果我想使用select join [或其他選項]從所有表中選擇一些數據,我該怎麼做?

Select Project_Name,Project_Detail,PR_Id,PO,PO_Date,Delivery_Id,Delivery_Date,Brand_Name,Product_Name,EQ,Price_PerUnit,etc... (very long) 

回答

0

內部聯接是產生一個新的虛擬表,根據ON狀態

所以你可以做盡可能多的,只要你想從內部聯接

select ...... 

from table1 inner join table2 on table1.id = table2.id // produce a new table 
      inner join table3 on table2.id = table3.id 
      and so on ..... 

打完行第一內加入:

table1  * table2       table3 
********************** inner join with ******** 
column... * column...      column...  

之後的第二內連接:

table1  *  table2  * table3 
******************************************* 
column... * column...  * column...