對不起,如果這太元素,但我不能解決它。不知道如何尋找它的信息之一:SQL查詢從相同ID的不同表中獲取所有數據
我有三個表:
提供商
id_provider name
---------- -----------
100 John
101 Sam
102 Peter
聯繫
id_contact RowNo Email
---------- ----------- ----------------
100 1 [email protected]
100 2 [email protected]
101 1 [email protected]
101 2 [email protected]
產品
Id_product RowNo Product
---------- ----------- ------------------------
100 1 John’s 1st product
100 2 John’s 2nd product
101 1 Sam’s 1st product
101 2 Sam’s 2nd product
101 3 Sam’s 3rd product
我需要aq uery顯示從這樣三個表中的所有數據:
Id name id_contact RowNo Email Id_Product RowNo Product
100 John 100 1 [email protected] 100 1 John’s 1st product
100 John 100 2 [email protected] 100 2 John’s 2st product
101 Sam 101 1 [email protected] 101 1 Sam's 1st product
101 Sam 101 2 [email protected] 101 2 Sam's 2nd product
101 Sam null null null 101 3 Sam's 3rd product
102 Peter null null null null null null
我想所有的連接,但我知道我不能使它發揮作用。
非常感謝