分享、学习、提高
2007/01/11 09:51
文章作者:9Enjoy 转载请注明原文链接。
update a set siteid = '4' where ContentID in (
SELECT a.ContentID FROM a left join b on a.ContentID = b.ContentID where  b.nodeid=13)

提示:
#1093 - You can't specify target table 'a' for update in FROM clause  

问了下gump,原来要这么写:

update a, b set a.siteid = '4' where a.ContentID = b.ContentID and b.nodeid=13
enjoy Homepage
2007/03/25 22:48
补充一下,如果是MSSQL,则应该是第一种写法:)
enjoy 回复于 2007/03/25 22:50
mysql正确的第二种反而会提示:
服务器: 消息 170,级别 15,状态 1,行 1
第 1 行: 'a' 附近有语法错误。

mysql和mssql不太一致哦。。。
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]