2017-04-14 120 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