应用 where 条件时无法从表中获取数据

发布于 2025-01-15 21:49:16 字数 1385 浏览 1 评论 0原文

Unable to get the data from the table after applying where conditio0n. manually checked all the tables the data is present in it.

Need help in resolving this issue.

I tried changing the where condition but still unable to get the data.

I assume the issue is in below condition however I'm unable to identify it

Below is the code:

SELECT
    a.OpportunityCode AS KPMG_Opportunity__c,
    CompetitorCode AS Account__c,
    CASE
        WHEN
            b.StageDescription = 'Won' 
        THEN
            'True' 
        ELSE
            'False' 
    END
    AS KPMG_Won_Opportunity__c, c.ConvertedOutcomeReasonCode, b.CloseDate, b.etl_rec_eff_end_ts, d.IsArchived 
FROM
    bpg_crm_opportunity_refined.oppty_competitors AS a 
    LEFT JOIN
        bpg_crm_opportunity_refined.oppty_header AS b 
        ON a.opportunitycode = b.OpportunityCode 
    LEFT JOIN
        bpg_oppty_mgmt_trusted.outcomereason_conversion_lkp c 
        ON b.OpportunityStatusCode_Orig = c.StatusCode 
    LEFT JOIN
        bpg_crm_engagement_trusted.edw_dim_entity d 
        ON b.PrimaryAccountCode = d.EntityID 
WHERE
    d.IsArchived != 'false' 
    and c.ConvertedOutcomeReasonCode != 'Z004A' 
    and date_part('Year', b.etl_rec_eff_end_ts) = '9999'

应用where条件0n后无法从表中获取数据。手动检查其中存在数据的所有表。

需要帮助来解决这个问题。

我尝试更改where条件但仍然无法获取数据。

我认为问题出在以下情况,但我无法识别它

Unable to get the data from the table after applying where conditio0n. manually checked all the tables the data is present in it.

Need help in resolving this issue.

I tried changing the where condition but still unable to get the data.

I assume the issue is in below condition however I'm unable to identify it

Below is the code:

SELECT
    a.OpportunityCode AS KPMG_Opportunity__c,
    CompetitorCode AS Account__c,
    CASE
        WHEN
            b.StageDescription = 'Won' 
        THEN
            'True' 
        ELSE
            'False' 
    END
    AS KPMG_Won_Opportunity__c, c.ConvertedOutcomeReasonCode, b.CloseDate, b.etl_rec_eff_end_ts, d.IsArchived 
FROM
    bpg_crm_opportunity_refined.oppty_competitors AS a 
    LEFT JOIN
        bpg_crm_opportunity_refined.oppty_header AS b 
        ON a.opportunitycode = b.OpportunityCode 
    LEFT JOIN
        bpg_oppty_mgmt_trusted.outcomereason_conversion_lkp c 
        ON b.OpportunityStatusCode_Orig = c.StatusCode 
    LEFT JOIN
        bpg_crm_engagement_trusted.edw_dim_entity d 
        ON b.PrimaryAccountCode = d.EntityID 
WHERE
    d.IsArchived != 'false' 
    and c.ConvertedOutcomeReasonCode != 'Z004A' 
    and date_part('Year', b.etl_rec_eff_end_ts) = '9999'

Unable to get the data from the table after applying where conditio0n. manually checked all the tables the data is present in it.

Need help in resolving this issue.

I tried changing the where condition but still unable to get the data.

I assume the issue is in below condition however I'm unable to identify it

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

━╋う一瞬間旳綻放 2025-01-22 21:49:16
SELECT
a.OpportunityCode AS KPMG_Opportunity__c,
CompetitorCode AS Account__c,
CASE
    WHEN
        b.StageDescription = 'Won' 
    THEN
        'True' 
    ELSE
        'False' 
END
AS KPMG_Won_Opportunity__c, 
 c.ConvertedOutcomeReasonCode, b.CloseDate, b.etl_rec_eff_end_ts, d.IsArchived 
FROM
bpg_crm_opportunity_refined.oppty_competitors AS a 
LEFT JOIN
(
  SELECT OpportunityCode,OpportunityStatusCode_Orig,PrimaryAccountCode,
         StageDescription,CloseDate,etl_rec_eff_end_ts
   FROM  bpg_crm_opportunity_refined.oppty_header
   WHERE b.etl_rec_eff_end_ts BETWEEN '99990101'AND '99991231'
)AS b ON a.opportunitycode = b.OpportunityCode 
LEFT JOIN
(
  SELECT ConvertedOutcomeReasonCode,StatusCode
  FROM 
    bpg_oppty_mgmt_trusted.outcomereason_conversion_lkp c 
    WHERE ConvertedOutcomeReasonCode != 'Z004A' 
)AS c    ON b.OpportunityStatusCode_Orig = c.StatusCode 
LEFT JOIN
(
  SELECT EntityID,IsArchived
  FROM 
    bpg_crm_engagement_trusted.edw_dim_entity  
   WHERE IsArchived != 'false' 
) D   ON b.PrimaryAccountCode = d.EntityID 

可能是这样的

SELECT
a.OpportunityCode AS KPMG_Opportunity__c,
CompetitorCode AS Account__c,
CASE
    WHEN
        b.StageDescription = 'Won' 
    THEN
        'True' 
    ELSE
        'False' 
END
AS KPMG_Won_Opportunity__c, 
 c.ConvertedOutcomeReasonCode, b.CloseDate, b.etl_rec_eff_end_ts, d.IsArchived 
FROM
bpg_crm_opportunity_refined.oppty_competitors AS a 
LEFT JOIN
(
  SELECT OpportunityCode,OpportunityStatusCode_Orig,PrimaryAccountCode,
         StageDescription,CloseDate,etl_rec_eff_end_ts
   FROM  bpg_crm_opportunity_refined.oppty_header
   WHERE b.etl_rec_eff_end_ts BETWEEN '99990101'AND '99991231'
)AS b ON a.opportunitycode = b.OpportunityCode 
LEFT JOIN
(
  SELECT ConvertedOutcomeReasonCode,StatusCode
  FROM 
    bpg_oppty_mgmt_trusted.outcomereason_conversion_lkp c 
    WHERE ConvertedOutcomeReasonCode != 'Z004A' 
)AS c    ON b.OpportunityStatusCode_Orig = c.StatusCode 
LEFT JOIN
(
  SELECT EntityID,IsArchived
  FROM 
    bpg_crm_engagement_trusted.edw_dim_entity  
   WHERE IsArchived != 'false' 
) D   ON b.PrimaryAccountCode = d.EntityID 

May be something like this

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文