/** 统计案件总数 统计未还款案件总数 统计 已还款案件总数*/
SELECT COUNT(loan_case_centre_test.CASE_ID) AS case_count, --案件总数
COUNT(CASE
WHEN loan_case_centre_test.WHETHER_URGE IN ('0') THEN --IN('条件值')
'no_repayment_count'
END) no_repayment_count, --未还款总数
COUNT(CASE
WHEN loan_case_centre_test.WHETHER_URGE IN ('1') THEN --IN('条件值')
'yes_repayment_count'
END) yes_repayment_count --已还款总数
FROM LOAN.LOAN_CASE_CENTRE loan_case_centre
where OVERDUE_STAGE='M7';
控制台结果