update三张表MySQL_MySQL 多张表更新 update

-- 仅更新description为空的记录

UPDATE freecms_info fi,

(select substring_index(content,'

',1) myDescription, id myId from freecms_info) f

set fi.description = CONCAT(f.myDescription,'

') where fi.id = f.myId  and (fi.description = "" or fi.description is null);

UPDATE freecms_info fi,

(select substring_index(content,'

',1) myDescription, id myId from freecms_info) f

set fi.description = CONCAT(f.myDescription,'

')

where fi.id = f.myId  and (fi.description = "" or fi.description is null) and site = "d2460263-4914-4cae-a93c-1c10f4fc15c6";

你可能感兴趣的:(update三张表MySQL)