10

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.

Raj
  • 22,346
  • 14
  • 99
  • 142
oscilatingcretin
  • 10,457
  • 39
  • 119
  • 206

1 Answers1

18
UPDATE A
FROM TableA A, TableB B
SET DepartmentId = B.DepartmentId
WHERE A.CustomerId = B.CustomerId 
Raj
  • 22,346
  • 14
  • 99
  • 142