2017-04-14 158 views
0

我正在使用Talend Open Studio進行數據集成。我有兩個表(的.csv文件):talend總和值

表1:

Date    Values 
01-04-2017   4 
02-04-2017   5 
03-04-2017   6 
04-04-2017   7 

表2:

Date   Values 
03-04-2017   10 
04-04-2017   12 
05-04-2017   15 
06-04-2017   18 

我希望得到一個輸出表上的日期外連接,並總結常用日期的值(表1和表2中僅存在一些日期,並且兩個表格中的日期相同): 預期輸出

Date    Values 
01-04-2017   4 
02-04-2017   5 
03-04-2017   16 
04-04-2017   19 
05-04-2017   15 
06-04-2017   18 

我嘗試過使用tmap和tjoin,但它對我無效。

回答

0

使用tUnite合併來自2個流的數據,然後tAggregateRow按日期求和值。

0

你可以嘗試這樣的..

在Talend,tMysqlInput -------> tLogRow

爲tMysqlInput使用查詢:

"select Date,sum(Values) as Values from (select * from table1 union select * from table2)t group by Date"

然後你會得到所需的結果.. :)

enter image description here

enter image description here

enter image description here