Mysql下SELECT的结果集作为UPDATE的WHERE条件时的SQL语法

UPDATE `WarningSendMail` AS alias_1 INNER JOIN (SELECT * FROM `WarningSendMail` WHERE flag=1 AND topic_id LIKE "%2267%") AS alias_2 SET alias_1.topic_id = REPLACE(alias_1.topic_id,'|2267','') WHERE alias_1.id = alias_2.id



update WarningSendMail set topic_id= REPLACE(topic_id,'|2267','') WHERE id IN ( SELECT id FROM WarningSendMail WHERE flag=1 AND topic_id LIKE "%2267%" );

  

posted @ 2017-11-16 19:20  陈泽泽  阅读(6130)  评论(0编辑  收藏  举报