根据条件更新字段
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>
相关文章推荐
- 更新 将B表的数据更新到A表中的某个字段的sql(根据条件)
- 将一张表的字段根据条件更新到另一张表的一个字段中去
- 同一字段根据不同条件更新的sql语句的写法
- SQL根据条件批量update更新字段案例
- SQL两表匹配,将A表的指定字段所有内容根据条件更新B表指定字段的所有内容
- 【数据库】同一字段根据不同条件更新的sql语句的写法
- thinkphp根据条件取得id值并更新个别字段的值
- 根据条件用一个表的字段,去更新另一个表的字段
- ElasticSearh更新nested字段(Array数组)。怎么根据查询条件(query)复制一个(index)到新的Index how to update by query a nested fields data for elasticsearch
- update语句根据条件更新某字段的值
- 根据字段条件增加一列
- 更新T1表,要添加一个条件A,但T1表没有A字段
- mysql 同一个字段作为条件更新
- mysql update中需要根据条件列更新写法update case
- 更新一个表字段根据子查询结果
- 根据条件修改FORM中当前行某一字段是否可编辑
- sql 根据指定条件获取一个字段批量获取数据插入另外一张表字段中+MD5加密
- Mysql根据条件批量更新动态数据
- sql语句的构造,当where后的条件个数不定,当update set后的更新字段数不定
- 单表 单字段多条件更新