You are on page 1of 2

=====================================================CQI===========================

================================

SELECT cqi_category, COUNT(cif) as jumlah


FROM `wsaidsu`.`aidsu_cqi_score`
LEFT OUTER JOIN `dm_analytics`.`dm_customer` ON
(aidsu_cqi_score.cif=dm_customer.cif_number)
WHERE `aidsu_cqi_score`.`dt_pr` = '20220430' AND `dm_customer`.`dt_pr` = '20220430'
AND flag_simobi = 'Y'
AND cqi_category = 'VERY POOR'
AND `aidsu_cqi_score`.`cif` IN (SELECT `aidsu_cqi_score`.`cif` FROM
`wsaidsu`.`aidsu_cqi_score` WHERE (`aidsu_cqi_score`.`dt_pr`='20220531')
cqi_category = 'EXCEPTIONAL')
GROUP BY cqi_category

=====================================================CR_LOAN=======================
====================================

SELECT credit_loan_perf_category, COUNT(cif) as jumlah


FROM `wsaidsu`.`aidsu_cqi_score`
LEFT OUTER JOIN `dm_analytics`.`dm_customer` ON
(aidsu_cqi_score.cif=dm_customer.cif_number)
WHERE `aidsu_cqi_score`.`dt_pr` = '20220430' AND `dm_customer`.`dt_pr` = '20220430'
AND flag_simobi = 'Y'
AND credit_loan_perf_category = 'VERY POOR'
AND cqi_category IS NOT NULL
AND `aidsu_cqi_score`.`cif` IN (SELECT `aidsu_cqi_score`.`cif` FROM
`wsaidsu`.`aidsu_cqi_score` WHERE (`aidsu_cqi_score`.`dt_pr`='20220531') AND
credit_loan_perf_category = 'EXCEPTIONAL' AND cqi_category IS NOT NULL)
GROUP BY credit_loan_perf_category

=====================================================SAVINGS=======================
====================================

SELECT savings_and_investment_category, COUNT(cif) as jumlah


FROM `wsaidsu`.`aidsu_cqi_score`
LEFT OUTER JOIN `dm_analytics`.`dm_customer` ON
(aidsu_cqi_score.cif=dm_customer.cif_number)
WHERE `aidsu_cqi_score`.`dt_pr` = '20220430' AND `dm_customer`.`dt_pr` = '20220430'
AND flag_simobi = 'Y'
AND savings_and_investment_category = 'VERY POOR'
AND cqi_category IS NOT NULL
AND `aidsu_cqi_score`.`cif` IN (SELECT `aidsu_cqi_score`.`cif` FROM
`wsaidsu`.`aidsu_cqi_score` WHERE (`aidsu_cqi_score`.`dt_pr`='20220531') AND
savings_and_investment_category = 'EXCEPTIONAL' AND cqi_category IS NOT NULL)
GROUP BY savings_and_investment_category

=====================================================CLTV==========================
=================================

SELECT cltv_category, COUNT(cif) as jumlah


FROM `wsaidsu`.`aidsu_cqi_score`
LEFT OUTER JOIN `dm_analytics`.`dm_customer` ON
(aidsu_cqi_score.cif=dm_customer.cif_number)
WHERE `aidsu_cqi_score`.`dt_pr` = '20220430' AND `dm_customer`.`dt_pr` = '20220430'
AND flag_simobi = 'Y'
AND cltv_category = 'VERY POOR'
AND cqi_category IS NOT NULL
AND `aidsu_cqi_score`.`cif` IN (SELECT `aidsu_cqi_score`.`cif` FROM
`wsaidsu`.`aidsu_cqi_score` WHERE (`aidsu_cqi_score`.`dt_pr`='20220531') AND
cltv_category = 'EXCEPTIONAL' AND cqi_category IS NOT NULL)
GROUP BY cltv_category

=====================================================LOYALTY=======================
====================================

SELECT loyalty_product_mix_category, COUNT(cif) as jumlah


FROM `wsaidsu`.`aidsu_cqi_score`
LEFT OUTER JOIN `dm_analytics`.`dm_customer` ON
(aidsu_cqi_score.cif=dm_customer.cif_number)
WHERE `aidsu_cqi_score`.`dt_pr` = '20220430' AND `dm_customer`.`dt_pr` = '20220430'
AND flag_simobi = 'Y'
AND loyalty_product_mix_category = 'VERY POOR'
AND cqi_category IS NOT NULL
AND `aidsu_cqi_score`.`cif` IN (SELECT `aidsu_cqi_score`.`cif` FROM
`wsaidsu`.`aidsu_cqi_score` WHERE (`aidsu_cqi_score`.`dt_pr`='20220531') AND
loyalty_product_mix_category = 'EXCEPTIONAL' AND cqi_category IS NOT NULL)
GROUP BY loyalty_product_mix_category

=====================================================ACTIVE========================
===================================

SELECT active_user_category, COUNT(cif) as jumlah


FROM `wsaidsu`.`aidsu_cqi_score`
LEFT OUTER JOIN `dm_analytics`.`dm_customer` ON
(aidsu_cqi_score.cif=dm_customer.cif_number)
WHERE `aidsu_cqi_score`.`dt_pr` = '20220430' AND `dm_customer`.`dt_pr` = '20220430'
AND flag_simobi = 'Y'
AND active_user_category = 'VERY POOR'
AND cqi_category IS NOT NULL
AND `aidsu_cqi_score`.`cif` IN (SELECT `aidsu_cqi_score`.`cif` FROM
`wsaidsu`.`aidsu_cqi_score` WHERE (`aidsu_cqi_score`.`dt_pr`='20220430') AND
active_user_category = 'EXCEPTIONAL' AND cqi_category IS NOT NULL)
GROUP BY active_user_category

You might also like