UPDATE car_approval a JOIN car_distribute b ON a.id = b.APPROVAL_FOR_CAR_ID SET a.APPROVAL_STATUS = 'approvalStatus-car-complete' WHERE b.ACK_STATUS = 'CarTaskStatus-EndCarTask' and a.APPROVAL_STATUS <> 'approvalStatus-car-complete';