[英]SQL error: Table name specified more than once
I am getting the error Table name specified more than once
after executing this code: 执行此代码后,我Table name specified more than once
获得错误Table name specified more than once
:
UPDATE Ref_zak_tab
SET uexdate = dbo.Data_inf.date
FROM dbo.Ref_zak_tab CROSS JOIN dbo.Data_inf
What can I do with this? 我该怎么办?
After trying alias I get this: 尝试别名后我得到这个:
UPDATE Ref_zak_tab rzt
SET uexdate = dbo.Data_inf.date
FROM dbo.Ref_zak_tab CROSS JOIN dbo.Data_inf
Update cancelled: attempt to update a target row with values from multiple join rows
For each row in the Ref_zak_tab
table CROSS JOIN
with the Data_inf
table returns multiple rows and perhaps therefore UPDATE
operator can not be successfully executed. 对于Ref_zak_tab
表中的每一行,将CROSS JOIN
与Data_inf
表一起返回多行,因此可能无法成功执行UPDATE
运算符。
Try to use INNER JOIN
instead. 尝试改用INNER JOIN
。
UPDATE rzt
SET rzt.uexdate = dt.date
FROM dbo.Ref_zak_tab rzt
INNER JOIN dbo.Data_inf dt ON (*join condition here*)
Are you trying to do what standard SQL would spell out as 您是否要执行标准SQL拼写为
SET uexdate = (SELECT date FROM dbo.Data_inf WHERE (condition here to determine single row in Data_inf) )
? ?
If so, then just write it like that. 如果是这样,那么就这样写。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.