簡體   English   中英

使用子查詢或聯接更新列

[英]Update a column using subquery or join

我需要使用select查詢中的resul更新table1的'DA_ArticleDetails'列。 我嘗試過這樣的事情:

UPDATE table1 
SET [DA_ArticleDetails] =
(
select RIGHT([DA_ArticleDetails], 8000)
from table1
)

但它給錯誤:

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.

有人可以幫我更新列嗎?

UPDATE table1 
SET [DA_ArticleDetails] = RIGHT([DA_ArticleDetails], 8000)
from table1

您可以簡單地調用以下查詢

UPDATE table1 
SET [DA_ArticleDetails] =RIGHT([DA_ArticleDetails], 8000)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM