zeusbart
6/24/2019 - 11:15 PM

cancelaciones sin pago pendiente

cancelaciones sin pago pendiente


SELECT app1.car_id, app1.appointment_id FROM pending_payment as pp1 join appointment as app1 on app1.appointment_id = pp1.appointment_id join slave_card_charge as scc on pp1.appointment_id = scc.appointment_id WHERE pp1.status = 1 AND app1.status in (4,5) AND scc.created_date >= '2019-06-03' and scc.created_date<'2019-06-10 00:00:00' AND scc.captured = 'true'


SELECT app.car_id, app.appointment_id FROM appointment as app WHERE app.created_dt >= '2019-06-03' and app.created_dt<'2019-06-10 00:00:00' AND app.amount > 0 AND (app.status in (4,5) AND NOT EXISTS( SELECT pp.appointment_id FROM pending_payment as pp WHERE pp.appointment_id = app.appointment_id))