2014-11-20 135 views
0

我試圖使用更新FROM子句從另一個Teradata的更新值一個表:選擇更新

update p84 
set p84.ACCOUNT_NME = p92.GL_ACCOUNT_NUM 
from D_FAR_SBXD.T_FSM_ACCOUNT_DIMENSION p84 
full outer join D_FAR_SBXD.T_FSM_ACCOUNT p92 on p84.ACCOUNT_NME = p92.ACCOUNT_NME 
where p92.ACCOUNT_TREE_NME='ACCT_OLAP_GAAP' 
and p84.ACCOUNT_NME is not null 
and p92.GL_ACCOUNT_NUM <> '999999' 
and p92.GL_ACCOUNT_NUM <> 'M99999' 

我有一個錯誤:[Teradata][ODBC Teradata Driver][Teradata Database] Syntax error: expected something between the word 'GL_ACCOUNT_NUM' and the 'from' keyword. (42000,-3706)

我缺少什麼?

回答

1

試試這個語法

UPDATE tablename 
FROM 
(
SELECT 
column1, 
column2, 
column3, 
. 
. 
FROM another_tablename) another 
SET column1 = another.column1, 
SET column2 = another.column2, 
SET column3 = another.column3, 
. 
. 
. 
WHERE tablename.column=another.column 

;