首页 > 代码库 > mysql - Error Code: 1093. You can't specify target table

mysql - Error Code: 1093. You can't specify target table

UPDATE card SET value = http://www.mamicode.com/(SELECT value FROM card WHERE id = 23) WHERE id = 20;

更新时 在where条件里面加入的子查询导致的。

解决方法:

 UPDATE card SET value = http://www.mamicode.com/(SELECT val FROM (SELECT value as val FROM card WHERE id = 23) as temp )WHERE id = 20;
使用临时表。

mysql - Error Code: 1093. You can't specify target table