繁体   English   中英

从 sql 查询创建 Informatica 映射

[英]Informatica mapping creation from sql query

我想在需要检查是否有重复的地方创建映射。 我有下面的 sql 查询,我必须从中创建映射。

Select count(1), A.market_cd
from (select distinct account_no, market_cd
   from Db1.Table1
   where $$monthenddate between date(eff_begin) and 
        date(eff_end) 
   group by account_no, market_cd having count(1) > 1
) A 
group by market_cd ;

Select count(1), A.market_cd
from (select distinct account_no, market_cd
   from Db2.Table2
   where $$monthenddate between date(eff_begin) and 
        date(eff_end) 
   group by account_no, market_cd having count(1) > 1
) A 
group by market_cd ;

Select count(1), A.market_cd
from (select distinct account_no, market_cd 
   from Db3.Table3
   where $$monthenddate between date(eff_begin) and 
        date(eff_end) 
   group by account_no, market_cd having count(1) > 1
) A 
group by market_cd

结果:-

Count | Market_cd
0

上述查询的理想结果应该是零行。 我必须检查结果是否有任何计数。

我必须在目标平面文件中联合上述所有查询。 可以使用哪些逻辑和转换来创建映射? 请有人帮忙

首先......你可以使用count (distinct account_no)并摆脱子查询。 更多信息在这里。

接下来,在 Informatica 中创建一个具有三个源和Source qualifiers的映射 - 与查询中的方式相同 - 为每个添加Aggregator并使用Union组合结果。

在每个Source Qualifier使用Source Filter属性根据您的需要限制行数,方法是$$monthenddate between date(eff_begin) and date(eff_end)放置$$monthenddate between date(eff_begin) and date(eff_end)

请记住添加映射变量并设置它的值,最好通过参数文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM