UPDATE multiple columns from another table in Teradata

You can update multiple columns in a table with multiple columns of another table in Teradata.

Sample code:
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; <Usually primary key fields join between two tables)



Example:
Suppose, i have to update the department table from employee table for the following fields
employee name, department name, department id.. Employee id is the primary key between two tables.

UPDATE tbl_department
FROM
(
SELECT
employee_name,
department_name,
department_id,
employee_id
FROM
tbl_employee ) emp

SET 
employee_name=emp.employee_name,
department_name=emp.department_name,
department_id=emp.department_id
WHERE
tbl_department.employee_id = emp.employee_id;