插入待兑付清单SQL备份

-- 插入待兑付清单
SELECT DISTINCT k1.link_no 
FROM lk_link_info k1, lk_issue_info k2
WHERE k1.issue_link_no = k2.issue_link_no
AND k1.link_status = 2 
AND TIMESTAMPDIFF(DAY, DATE_FORMAT(NOW(), '%Y-%m-%d'), k2.payoff_date) = '15'

-- 系统定时作废开单并插入到待兑付清单
SELECT DISTINCT k1.link_no 
FROM lk_link_info k1, lk_issue_info k2
WHERE k1.issue_link_no = k2.issue_link_no
AND k1.link_status != 2 
AND k1.link_flow_status IN (3,-3,4,-4,5,-5,6,-6,7,-7) 
AND k1.link_source_type = 'ISSUE' 
AND TIMESTAMPDIFF(DAY, DATE_FORMAT(NOW(), '%Y-%m-%d'), k2.payoff_date) = '15'

-- 系统定时作废转单并插入到待兑付清单
SELECT DISTINCT k1.link_no 
FROM lk_link_info k1, lk_issue_info k2
WHERE k1.issue_link_no = k2.issue_link_no
AND k1.link_status != 2
AND k1.link_flow_status IN (6,-6,7,-7,9,10,-10,11,-11)
AND (k1.link_source_type = 'TRANSFER' OR k1.link_source_type = 'TRANSFER_RETAIN') 
AND TIMESTAMPDIFF(DAY, DATE_FORMAT(NOW(), '%Y-%m-%d'), k2.payoff_date) = '15'

 

posted @ 2021-09-15 17:45  xuebusi  阅读(89)  评论(0编辑  收藏  举报