Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Teradata update join syntax

Tags:

sql

join

teradata

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.

like image 239
oscilatingcretin Avatar asked Feb 10 '12 14:02

oscilatingcretin


1 Answers

UPDATE A
FROM TableA A, TableB B
SET DepartmentId = B.DepartmentId
WHERE A.CustomerId = B.CustomerId 
like image 160
Lenin Raj Rajasekaran Avatar answered Sep 28 '22 08:09

Lenin Raj Rajasekaran