I am trying to update a table column based off a subquery from the same table. The table has columns Name Id and Target Id. I am trying to take a subset of name and Id and populate column Target Id. For Example, I am tring to get all the id whose value is 2 and populate all the Target Id that has name XXX and YYY in this example and so
Name ID Target Id
XXX 13
XXX 29
XXX 31
YYY 17
YYY 29
YYY 38
Result trying to get:
Name ID Target Id
XXX 13 29
XXX 29 29
XXX 31 29
YYY 17 29
YYY 29 29
YYY 38 29
I have tried this statement
UPDATE tableA a LEFT JOIN (SELECT name, id
FROM tableA
WHERE = '2') b
on a.Name = b.Name
SET a.Tartget_id = b.Id
I get error in Oracle using TOAD : ORA-00971: missing SET keyword