UPDATE opportunity INNER JOIN opp_stage_checklist ON opportunity.id = opp_stage_checklist.opp_id AND opportunity.stage_number = opp_stage_checklist.stage_number <set> opportunity.status_code = 3,opportunity.update_date = NOW() </set> WHERE ( DATE_ADD(opp_stage_checklist.check_time, Interval opp_stage_checklist.offset_value month)) < NOW() AND opportunity.stage_number = 2 AND !(opportunity.status_code = 3 OR opportunity.status_code = 4);
UPDATE opportunity <set> status_code = #{statusCode}, update_date = NOW() </set> WHERE id IN <foreach item="item" index="index" collection="oppIds" open="(" separator="," close=")"> #{item} </foreach>