我正在尝试使用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)
我错过了什么?
答案 0 :(得分: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