-3
UPDATE suggest 
SET 
`    post_id`="5286" 
where 
  `post_id`  IN 

( SELECT `post_id` FROM `suggest` WHERE `word` LIKE "%word%" )
4

2 回答 2

2

这里不需要使用子查询。

UPDATE suggest 
SET `post_id`="5286" 
WHERE `word` LIKE "%word%"
于 2012-12-29T16:14:09.713 回答
0

MySQL 错误 1093 - 无法在 FROM 子句中指定要更新的目标表

这是一篇关于此的帖子。

您可以使用此查询来实现此目的。

update suggest as a inner join (select post_id from suggest where word like '%word%') as b on a.post_id = b.post_id set a.post_id="5286";
于 2012-12-29T16:18:50.540 回答