2017-01-10 69 views
-1

我有兩個表。
表1加入兩個表並生成具有相同值的表在兩個不同的行

CRS Name   Total_Exposure_Amount 

Ackerman & Co LLC 152,823.00 
Arbeit investments 489,756,203.00 
Ashton woods   4,785,683.25 
Alience Residential 235,694.58 

表2

CRS_Name    Outstanding_balance 
Ackerman & Co LLC  123,566.23 
Ackerman & Co LLC  0.21 
Arbeit investments 2,331.26 
Arbeit investments 32,566.00 
Ashton woods   123,462 
Ashton Woods   36,245.24 
Alience Residential 32,134.26 

決賽桌我需要的就是這樣的

決賽桌

CRS_Name    Outstanding_Balance   Relations_TBE 
Ackerman & Co LLC 123,566.23     152,823.00 
Ackerman & Co LLC 0.21       152,823.00 
Arbeit Investments 2,331.26      489,756,203.00 
Arbeit Investments 32,566.00     489,756,203.00 
Ashton woods   123,462      4,785,683.25 
Ashton Woods   36,245.24     4,785,683.25 
Alience Residential 32,134.26     235,694.58 

反正是有,我們可以用做Proc sql?任何幫助將不勝感激。

+1

提示:'JOIN'。你有什麼嘗試? –

回答

0

它是基於兩個表之間的公共密鑰(這種情況下是CRS_Name)的兩個表之間的簡單聯接。

proc sql; 
     create table final_table as 
     select a.CRS_NAme,b.Outstanding_Balance, a.Outstanding_balance 
     from table_1 a, table_2 b 
     where a.CRS_Name= b.CRS_Name; 
    quit; 
+0

最好在代碼中包含一些上下文/解釋,因爲這會使OP對未來的讀者更有用。 – EJoshuaS

相關問題