[英]Update a column using subquery or join
I need to update the 'DA_ArticleDetails' column of table1 using the resul from the select query. 我需要使用select查询中的resul更新table1的'DA_ArticleDetails'列。 I tried something like this: 我尝试过这样的事情:
UPDATE table1
SET [DA_ArticleDetails] =
(
select RIGHT([DA_ArticleDetails], 8000)
from table1
)
but its giving error: 但它给错误:
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
Could anyone help me how to update the column? 有人可以帮我更新列吗?
UPDATE table1
SET [DA_ArticleDetails] = RIGHT([DA_ArticleDetails], 8000)
from table1
You can simply call the following query 您可以简单地调用以下查询
UPDATE table1
SET [DA_ArticleDetails] =RIGHT([DA_ArticleDetails], 8000)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.