oscilatingcretin
oscilatingcretin

Reputation: 10959

Teradata update join syntax

I've tried a few examples I've seen on the internet, but I can't seem to figure them out. This is a Teradata database.

I have TableA that has CustomerId and DepartmentId.

I have TableB that also CustomerId and DepartmentId.

I know this structure is not practical, but this is a highly non-normalized database that we took over from an offshore development team and we have to work with what we have.

What I want to do is join TableA and TableB on the CustomerId then set the DepartmentId of TableB to what's in TableA. I would greatly appreciate the proper syntax.

Upvotes: 11

Views: 38980

Answers (1)

Raj
Raj

Reputation: 22956

UPDATE A
FROM TableA A, TableB B
SET DepartmentId = B.DepartmentId
WHERE A.CustomerId = B.CustomerId 

Upvotes: 19

Related Questions