UPDATE clinical_visits JOIN clinical_patients SET clinical_visits.type = 'Revisit' WHERE DATEDIFF(clinical_visits.created_datetime, clinical_patients.created_datetime) > 0