select a.id, max(b.amount_after) as initial_amount, c.consume_amount from mcc_amount_change_record b
left join mcc_customer a on a.id = b.customer_id
left join (select customer_id, min(consume_date) as min_consume_date, consume_amount from mcc_customer_consume group by customer_id ) as c on c.customer_id = b.customer_id
where register_date > "2017-04-01 00:00:00"
and create_time < min_consume_date
and amount_after >= "500"
and consume_date = min_consume_date
group by id
consume_date 在 mcc_customer_consume表里有