简体   繁体   English

使用 SQL,伪代码查找订户在给定的两个组中是否处于活动状态(医疗保健)

[英]Using SQL, Pseudo code for finding whether subscriber is active or not in the given two groups in facets(Healthcare)

`As per the screenshot, the requirement states whether the subscriber id is active or not in the given groups (W0051752 and E0001000). `根据屏幕截图,要求说明订户 ID 在给定组(W0051752 和 E0001000)中是否处于活动状态。

  1. If subscriber present in either W0051752 or E0001000 then it is active如果订户出现在 W0051752 或 E0001000 中,那么它是活动的

  2. If subscriber present in both the groups means it is inactive and it will log an error in CDM table(table which store the list of errors for future reference).如果两个组中都存在订户意味着它处于非活动状态,它将在 CDM 表(存储错误列表以供将来参考的表)中记录错误。

  3. If subscriber present in any other groups then it will log an error.如果订阅者出现在任何其他组中,那么它将记录一个错误。

Can you please check screenshot that I have attached and help me to solve the requirement using SQL您能否查看我附上的屏幕截图并帮助我使用 SQL 解决需求

CASE when (case when (grp_id ='E0001000' || grp_id ='W0051752') then err_cd ='v' when (grp_id ='E0001000' & grp_id ='W0051752') then err_cd ='E' else err_cd ='E' CASE when (case when (grp_id ='E0001000' || grp_id ='W0051752') then err_cd ='v' 当 (grp_id ='E0001000' & grp_id ='W0051752') then err_cd ='E' else err_cd ='E'

NOTE: grp_id, err_cd are the variables that I have declared注意:grp_id、err_cd 是我声明的变量

This is the pseudo code i have tried for the given requirement but not getting the correct output.这是我针对给定要求尝试但未获得正确输出的伪代码。 Here I have not given the condition whether the subscriber is active or not.这里我没有给出订阅者是否活跃的条件。 I don't know how to proceed further.`我不知道如何进一步进行。

informatica doesnt have case when, you can use IIF() or decode instead. informatica 没有情况,您可以使用IIF()或解码。 So, you can change your code like below.因此,您可以像下面这样更改代码。
In exp transformations add this var port.在 exp 转换中添加此 var 端口。

v_err_cd = 
IIF(
grp_id ='E0001000' AND grp_id ='W0051752', 'E',
IIF( grp_id ='E0001000' OR grp_id ='W0051752', 'v', 'E'
))

Pls note i put AND in the beginning because in your case even if one condition is true, you will get V as output.请注意我把 AND 放在开头,因为在你的情况下,即使一个条件为真,你也会得到V作为输出。

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

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