1
update table1 set isDeleted = 1 where isDeleted = 0 and mId in (select id from table1 where isDeleted = 1 ); 

Error Code: 1093. You can't specify target table 'table1' for update in FROM clause

2

1 Answer 1

2

Use a join:

UPDATE table1 t1 JOIN table1 t2 ON t1.mId = t2.id SET t1.isDeleted = 1 WHERE t1.isDeleted = 0 AND t2.isDeleted = 1 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.