Reputation: 424
I am attempting to update one table with values from another in Teradata using an update from clause:
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'
I have an error: [Teradata][ODBC Teradata Driver][Teradata Database] Syntax error: expected something between the word 'GL_ACCOUNT_NUM' and the 'from' keyword. (42000,-3706)
What am I missing?
Upvotes: 0
Views: 472
Reputation: 960
Try this syntax
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
;
Upvotes: 1