This shows you the differences between two versions of the page.
kurs:merge_accountants [2010/05/18 11:15] 127.0.0.1 external edit |
kurs:merge_accountants [2014/09/10 21:22] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | <code> | + | |
- | merge into accountants a | + | |
- | using ( | + | |
- | SELECT employees.employee_id, first_name, last_name, hire_date, salary, job_title | + | |
- | FROM employees, jobs | + | |
- | WHERE ((jobs.job_id = employees.job_id) | + | |
- | AND (jobs.job_title LIKE 'Account%') ) | + | |
- | ) e | + | |
- | on (a.employee_id = e.employee_id) | + | |
- | when matched then update set a.salary = e.salary | + | |
- | when not matched then insert | + | |
- | (first_name, last_name, employee_id, hire_date, salary, job_title) | + | |
- | values | + | |
- | (e.first_name, e.last_name, e.employee_id, e.hire_date, e.salary, e.job_title) | + | |
- | </code> | + |