Oracle 统计最近6个月满足条件的客户
SELECT
c.*
FROM
AVERAGE_DAILY_OVERDRAFT c,CUSTOMER_ACCOUNT_INFORMATION b
WHERE
TO_DATE (c.YEAR||c.MONTH, ‘YYYYMM‘) <![CDATA[ <= ]]>SYSDATE
AND TO_DATE (c.YEAR||c.MONTH, ‘YYYYMM‘) > ADD_MONTHS (SYSDATE, - 6)
AND not EXISTS(
select * from AVERAGE_DAILY_OVERDRAFT a where a.ACCOUNT_NUMBER = c.ACCOUNT_NUMBER
and a.ALL_DUE_STATUS = 0
)
AND c.ACCOUNT_NUMBER=b.ACCOUNT_NUMBER
and c.TOTAL_AMOUNT_OVERDRAFT/b.CREDIT_AMOUNT >=0.5
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。