📜  从选择 sqlite 更新 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:13.785000             🧑  作者: Mango

代码示例3
UPDATE employees
SET hire_date = (SELECT departments.start_date
                 FROM departments
                 WHERE departments.department_id = employees.department_id
                 AND departments.department_name = 'HR')
WHERE EXISTS (SELECT *
              FROM departments
              WHERE departments.department_id = employees.department_id
              AND departments.department_name ='HR');