您的位置:首页 > 其它

根据条件更新字段

2017-11-29 16:48 239 查看
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>

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: