I have tried two different update SQL query but facing the error:
Warning: Null value is eliminated by an aggregate or other SET operation.
And
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.
I don`t know where I am doing wrong?
Please find the two queries below.
Query One:
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'))
Query Two:
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')
You can write your query two like this. Query Two :