SQL - update table using another table field

I am trying to execute the following update request:

UPDATE Commodities 
INNER JOIN UniqueCountries 
     ON Commodities.wbCode = UniqueCountries.wbCode 
SET Idenb = UniqueCountries.wbName||yr

The request is clearly invalid because it does not work. How can i fix this?


The query must update the column IdenBusing the concatenated value wbNameand yr( wbName||yr). However, it wbNameis in another table called UniqueCountries, so I tried to execute Inner Join.

What am I doing wrong and how to fix it? Thank you very much.

+5
source share
1 answer

I do not see any indications in documents which are FROMor are JOINsupported in operators UPDATE.

, , .

UPDATE Commodities  
SET Idenb = (SELECT UniqueCountries.wbName||yr 
             FROM UniqueCountries 
             WHERE Commodities.wbCode = UniqueCountries.wbCode)
+4

All Articles