select i.id,i.days,i.money,i.create_time,l.loan_id,l.username,l.mobile,l.days,l.amount,l.fee,l.create_time,lo.source,lo.account_id ,i.user_id
from cm_relation_cg as cm LEFT JOIN cm_invest_order as i on cm.invest_order_id=i.id
LEFT JOIN cm_loan_order as lo on cm.loan_order_id=lo.id
LEFT JOIN cm_interest as ci on lo.id=ci.loan_order_id
LEFT JOIN yi_loans as l on lo.loan_source_id=l.id where ci.create_time>='2018-06-20 00:00:00' AND ci.create_time<='2018-06-20 23:59:59' AND lo.tag_type=3;