簡體   English   中英

SQL從(選擇內部聯接)中選擇內部聯接?

[英]SQL Select inner join from (Select inner join)?

嗨,我嘗試從另一個表的內部聯接中選擇數據內部聯接(當我不帶示例地講時,這很奇怪,這就是為什么我沒有從Google得到任何結果的原因)。 這是我的數據庫。

我的數據庫流程圖圖片

我想從表中的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)

內部聯接是根據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...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM