完全外联或联盟?

Zo *_*Has 3 sql db2

困惑如何实现这一点可能与FULL OUTER或UNION.我想以这样的方式加入结果

Table1                     Table2
---------------           ----------------- 
ID  Name Salary           ID    Fruits
---------------           ----------------- 
1   John   1000           1     Apples 
1   Henry  4000           1     Mangoes 
1   Smith  1000           1     Tomatoes
Run Code Online (Sandbox Code Playgroud)

结果应该是

ResultTable
       ------------------------
       ID Name  Salary  Fruits
       -----------------------   
       1  John  1000    Apples
       1  John  1000    Mangoes
       1  John  1000    Tomatoes
       1  Henry 4000    Apples
       1  Henry 4000    Mangoes
       1  Henry 4000    Tomatoes
       1  Smith 1000    Apples
       1  Smith 1000    Mangoes
       1  Smith 1000    Tomatoes 
Run Code Online (Sandbox Code Playgroud)

Gab*_*oli 10

您需要笛卡尔产品加入或交叉加入..

SELECT 
  *
FROM
  table1, table2
Run Code Online (Sandbox Code Playgroud)

要么

SELECT
  * 
FROM 
  table1 CROSS JOIN table2
Run Code Online (Sandbox Code Playgroud)

(参考:http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/sqlp/rbafymstcrojo.htm)