exec("DELETE FROM resource_request_appointments WHERE appointment_id NOT IN (SELECT termin_id FROM termine)"); } }