转介绍和支付方式

SELECT
        tc.contract_id 合同编号,
        (case when s.coil_in in (13,22) or s.know_origin in (16,22,24,25,56,41,71) then '转介绍' else '非转介绍' end ) 是否转介绍,
      (case when 
        sum(case when tcp.pay_method_new  in('baidu','hjzy','tonglian','jd','msh','haimi','zhongyin','haier') then 1 else 0 end) >= 1 then '分期' 
        when sum(case when tcp.pay_method_new in ('cmbLife','huabei','kufenqi','lebaifen') then 1 else 0 end) >= 1 then '信用卡' else '全款' end) 支付方式
FROM
        view_tms_contract tc
LEFT JOIN
        view_student s on s.student_intention_id = tc.student_intention_id
LEFT JOIN
        view_tms_contract_payment tcp on tcp.contract_id = tc.contract_id
WHERE
        tc.contract_id in ()
GROUP BY
        tc.contract_id
文档更新时间: 2019-08-19 11:17   作者:admin