简体   繁体   English

多次指定表名

[英]Table name is specified more than once

I am getting the ERROR: "table name 'temp' specified more than once" when trying to perform a join on two tables. 我在尝试对两个表执行联接时收到错误:“表名'temp'多次指定”。 Every example I've look at is set out as mine is so what is wrong? 我看过的每个例子都是我的例子,那是什么错呢?

UPDATE info.temp
SET RobberID = info.Robber.RobberID
FROM info.temp
INNER JOIN info.Robber
ON info.temp.NickName = info.Robber.NickName;

Try one of these 尝试其中之一

UPDATE t1
SET RobberID = info.Robber.RobberID
FROM info.temp as t1
INNER JOIN info.Robber as t2
ON t1.NickName = t2.NickName;

or 要么

UPDATE info.temp
SET RobberID = (select info.Robber.RobberID FROM info.Robber
WHERE info.temp.NickName = info.Robber.NickName)

your are updating info.temp by value form info.temp in wrong way do this way 您正在通过错误的方式按值形式从info.temp更新info.temp这样做

UPDATE info.temp
SET RobberID =  (select info.Robber.RobberID
FROM info.temp
INNER JOIN info.Robber
ON info.temp.NickName = info.Robber.NickName);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM