Actually i like to update a column from table A with a value from table B on some
conditions. The query is as follows:
update krms_Stg.SVHC_RAWTREESTRUCTUREDATAFORALL a
set a.Wt_Fatherid =
from krms_Stg.RAWTREESTRUCTUREDATAFORALL a1
where a1.NODEID_FATHER=a.NODEID_SON and
where a.TOP_LEVEL_NODE_ID=a1.TOP_LEVEL_NODE_ID and
But it is throwing an error saying the alias A1 is not recognized.
merge into krms_Stg.SVHC_RAWTREESTRUCTUREDATAFORALL a
using krms_Stg.RAWTREESTRUCTUREDATAFORALL a1
on a1.NODEID_FATHER = a.NODEID_SON
and a1.TOP_LEVEL_NODE_ID = a.TOP_LEVEL_NODE_ID
when matched then
update set a.Wt_Fatherid = a1.value
Thanks tonkuma... But still am having a problem..
Am getting this error..
SQL0788N The same row of target table "KRMS_STG.SVHC_RAWTREESTRUCTUREDATAFORALL" was identified more than once for an update, delete or insert operation of the MERGE statement. SQLSTATE=21506