更新 Sql 查询时遇到错误

Facing Error While Updating Sql Query

我尝试了两种不同的更新 SQL 查询,但遇到错误:

Warning: Null value is eliminated by an aggregate or other SET operation.

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 DB1..UScustomer 
set area='India' 
WHERE (customerid = '1') AND (area = 'US') 
  AND (areatransid in (select areaTransactionId 
                       from DB2..AllCustomer 
                       where area='US' and customerid='1' and statusId='2'))

查询二:

update DB1..UScustomer 
SET area='India' 
from DB1..UScustomer M1 
inner join DB2..AllCustomer M2 
      on M1.areatransid=S1.areaTransactionId and S1.statusId=2 
WHERE (customerid = '1') AND (area = 'US')

你可以这样写你的查询二。 查询二:

update M1 
    SET area='India' 
    from DB1..UScustomer M1 
    inner join DB2..AllCustomer M2 
          on M1.areatransid=M2.areaTransactionId and M2.statusId=2 
    WHERE (M1.customerid = '1') AND (M1.area = 'US') AND (M2.customerid = '1') AND (M2.area = 'US')