UPDATE table1 JOIN Table2 on Table1.id = Table2.id SET AB = CASE WHEN C / ((A + B)/ 2) > 1 THEN "A..." ELSE "B..." END