How to UPDATE one column using another column in another table? SQL Error: ORA-00933: SQL command not properly ended

前端 未结 4 657
余生分开走
余生分开走 2021-01-17 08:43

I have tried everything I can think of but couldn\'t solve this SQL error:

SQL Error: ORA-00933: SQL command not properly ended

4条回答
  •  春和景丽
    2021-01-17 09:26

    UPDATE SALES_DATA_FAMILY_2007 A 
    SET A.POG_ID= (select B.POG_ID 
                     FROM POG_HIERARCHY B  
                    WHERE A.FAMILY_ID=B.FAMILY) ;
    

    This will work if and only if there's at most one corresponding row in POD_HIERARCHY for a given FAMILY. If there's more than one row in POD_HIERARCHY, then you need to determine which row from POD_HIERARCHY you wish to use the value from.

提交回复
热议问题