Reputation: 2977
Writing a simple update statement in Teradata and I'm having trouble getting it to work. I'm getting a syntax error saying: Syntax error: expected something between the word 'First_name' and the 'FROM' keyword
. This is reference to line 7. I have no idea what I'm missing.
Here's the code with some redacted object names:
UPDATE DATA.CONTACTS tgt
SET
tgt.LAST_NAME = TABLES.PART.LAST_NAME
,tgt.BPP_USER_ID = TABLES.PART.User_Id
,tgt.Email_Address = TABLES.PART.Email
,tgt.Last_name = TABLES.PART.Last_name
,tgt.First_name = TABLES.PART.First_name
FROM
(SELECT
C_C
, USER_ID
, Email
,Last_name
,First_name
FROM TABLES.PART) --ppage
WHERE EMAIL_ADDRESS IN (
SELECT Email
FROM DATA.CONTACTS
);
select * from mmbi_tables_data.crm_mmbi_contacts
I've tried deleting using that ppage alias but I still get the same error regardless of what I do.
Upvotes: 0
Views: 244
Reputation: 1270723
This doesn't look so simple. I think the following will work in Teradata:
UPDATE tgt
FROM data.contacts tgt, tables.part ppage
SET LAST_NAME = TABLES.PART.LAST_NAME,
BPP_USER_ID = TABLES.PART.User_Id,
Email_Address = TABLES.PART.Email,
Last_name = TABLES.PART.Last_name,
First_name = TABLES.PART.First_name
WHERE tgt.email = ppage.email_address;
Upvotes: 1