update forum_members
set is_multi = 1
where M_NAME IN(
select M_NAME from forum_members
)
这样写就会报错
正确写法 如下
UPDATE forum_members AS A
INNER JOIN (
SELECT M_NAME
FROM forum_members
) AS B ON A.M_NAME = B.M_NAME
SET A.is_multi =1
实际应用
UPDATE recipes AS r1
INNER JOIN (
SELECT id,image
FROM recipes
) AS r2 ON r1.id = r2.id
SET r1.image =concat("main_",r2.image)