JOIN test_mzh.repay_record_amount rr ON rr.record_id = brprrr.record_id AND rr.repay_channel = brprrr.repay_channel AND rr.repaid_at >= '%s' AND rr.repaid_at < '%s'
JOIN user_bt_repayment_plan ubrp ON ubrp.id = brprrr.plan_id
JOIN baitiao_audit.baitiao_order bo ON bo.ref_id = ubrp.ref_id -- and bo.is_active in(1,-2)
JOIN baitiao_audit.baitiao_order bo ON bo.ref_id = ubrp.ref_id and bo.is_active in(1,-2)
JOIN merchant m ON m.merchant_id = bo.merchantId
JOIN baitiao_audit.fund_corp fc ON fc.id = bo.funding_corp_id and bo.funding_corp_id=1
JOIN new_transaction.repay_channel rc ON rc.id = brprrr.repay_channel
...
...
@@ -73,7 +73,7 @@ FROM baitiao_repay_plan_repay_record_ref brprrr
JOIN test_mzh.repay_record_amount rr ON rr.record_id = brprrr.record_id AND rr.repay_channel = brprrr.repay_channel AND rr.repaid_at >= '%s' AND rr.repaid_at < '%s'
JOIN user_bt_repayment_plan ubrp ON ubrp.id = brprrr.plan_id
join bt_funding_repayment_plan bfrp on ubrp.repayment_plan_id =bfrp.repay_plan_id and ubrp.sys_tag='XYQB_BILL_BT'
JOIN baitiao_audit.baitiao_order bo ON bo.ref_id = ubrp.ref_id and bo.funding_corp_id=5 -- and bo.is_active in(1,-2)
JOIN baitiao_audit.baitiao_order bo ON bo.ref_id = ubrp.ref_id and bo.funding_corp_id=5 and bo.is_active in(1,-2)
JOIN merchant m ON m.merchant_id = bo.merchantId
JOIN baitiao_audit.fund_corp fc ON fc.id = bo.funding_corp_id
JOIN new_transaction.repay_channel rc ON rc.id = brprrr.repay_channel
...
...
@@ -103,7 +103,7 @@ SELECT
FROM new_transaction.baitiao_cash_repay bcr
JOIN (select repay_id,record_id,repay_channel,sum(ref_amount)ref_amount from new_transaction.baitiao_cash_record_ref group by 1,2) bcrr ON bcrr.repay_id = bcr.id
JOIN test_mzh.repay_record_amount rra ON rra.record_id = bcrr.record_id and rra.amount=bcrr.ref_amount AND bcrr.repay_channel in(18,24) AND rra.repaid_at >= '%s' AND rra.repaid_at < '%s'
JOIN baitiao_order bo ON bo.ref_id = bcr.ref_id -- and bo.is_active in(1,-2)
JOIN baitiao_order bo ON bo.ref_id = bcr.ref_id and bo.is_active in(1,-2)
JOIN merchant m ON m.merchant_id = bo.merchantId
JOIN baitiao_audit.fund_corp fc ON fc.id = bo.funding_corp_id
JOIN new_transaction.repay_channel rc ON rc.id = bcrr.repay_channel;