答案 0 :(得分:1)
另一列在另一个表中。您必须像这样连接您的表(这是两个表之间的示例,由于我不知道您的架构如何,因此我无法为您提供确切的查询):
UPDATE A SET
A.COLUMN1 = 1
FROM TABLE1 AS A
JOIN TABLEB AS B ON A.ID = B.ID
答案 1 :(得分:1)
要引用表,您必须在FROM
或JOIN
子句中使用它:
UPDATE dbo.SALES_ORD_HDR
SET X_PickingSlip_Printed = 1
WHERE SEQNO IN (SELECT HEADER_SOURCE_SEQ FROM dbo.SALESORDHIST);
-- here you are refering table
或者使用相关子查询:
UPDATE dbo.SALES_ORD_HDR
SET X_PickingSlip_Printed = 1
WHERE EXISTS (SELECT 1 FROM dbo.SALESORDHIST
WHERE dbo.SALES_ORD_HDR.SEQNO = dbo.SALESORDHIST.HEADER_SOURCE_SEQ);