Hi,
I have two queries with slightly different where clauses that I would like to combine into 1 query.
Query 1 -
select count(distinct CASE WHEN a11.P1_CALLS>0 THEN a11.PRSBR_CID ELSE NULL END) WJXBFS1,
sum(a11.P1_CALLS) WJXBFS2,
sum(a11.SMPL) WJXBFS3,
count(distinct CASE WHEN a11.CALLS>0 THEN a11.PRSBR_CID ELSE NULL END) WJXBFS4,
count(distinct CASE WHEN a11.SMPL>0 THEN a11.PRSBR_CID ELSE NULL END) WJXBFS5
from MSTRATDM.FCT_PRSB_ACT a11
join MSTRATDM.DIM_ACTIVE_PRSBR a12
on (a11.PRSBR_PIT_SID = a12.PRSBR_PIT_SID)
join MSTRATDM.DRV_DATA_RLG_WK a13
on (a11.CALN_WK_STTC_SID = a13.CALN_WK_STTC_SID)
join MSTRATDM.DIM_PROD_DM_GRP a14
on (a11.PROD_ABBR = a14.CORP_PROD_GRP_ABBR and
a11.PROD_DM_GRP_STTC_SID = a14.PROD_DM_GRP_STTC_SID)
where (a14.PROD_MKT_DM_STTC_SID in (601500)
and a13.DATA_RLG_WK_NUM = 0
and a14.CORP_PROD_GRP_NM in ('test1')
and a12.BRO_SLS_ALIGN_LVL7_NUM not like 'D9%')
Query 2 -
select sum((a11.TCU * a11.PDRP_FCTR)) WJXBFS6,
sum((a11.TRX * a11.PDRP_FCTR)) WJXBFS7
from MSTRATDM.FCT_PRSB_PGP_W a11
join MSTRATDM.DIM_ACTIVE_PRSBR a12
on (a11.PRSBR_PIT_SID = a12.PRSBR_PIT_SID)
join MSTRATDM.DRV_DATA_RLG_WK a13
on (a11.DATA_RLG_WK_NUM = a13.DATA_RLG_WK_NUM)
join MSTRATDM.DIM_PROD_DM_GRP a14
on (a11.PROD_DM_GRP_STTC_SID = a14.PROD_DM_GRP_STTC_SID and
a11.TC_ABBR = a14.TC_ABBR)
where (a14.PROD_MKT_DM_STTC_SID in (601500)
and a11.EXCLSN_FCTR = 1
and a13.DATA_RLG_WK_NUM = 0
and a14.CORP_PROD_GRP_NM in ('test1')
and a12.BRO_SLS_ALIGN_LVL7_NUM not like 'D9%')
Could anyone help with this?