Home >Database >Mysql Tutorial >mysql update语句问题:You can't specify target table 'user_MySQL

mysql update语句问题:You can't specify target table 'user_MySQL

WBOY
WBOYOriginal
2016-06-01 13:43:241097browse

bitsCN.com

学习MYSQL过程中,拿mysql 中的user 表来折腾一下,发现mysql中的子查询有些问题,比方说,现在user表的内容如下图:
mysql update语句问题:You can't specify target table 'user_MySQL
 

想把它变成如下图所示:
mysql update语句问题:You can't specify target table 'user_MySQL
 

按说应该很简单的嘛,用个子查询就应该OK了啊,结果却报错:You can't specify target table 'user' for update in FROM clause。
mysql update语句问题:You can't specify target table 'user_MySQL
 

怎么这么简单的东西,还通不过,奇怪,赶紧百度一下,竟然在mysql不能这样用法,faint,修改一下语句,如下,就OK了,就是需要多倒腾一下子才行,相当于弄个临时表,再弄个别名,真的很麻烦啊,希望mysql尽快解决这个无聊的事情吧。

mysql update语句问题:You can't specify target table 'user_MySQL



摘自 sdjjt 的BLOG

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn