User Tools

Site Tools


kurs:sets_gruppenoperatoren

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
kurs:sets_gruppenoperatoren [2012/09/25 17:22]
127.0.0.1 external edit
kurs:sets_gruppenoperatoren [2012/10/04 15:43]
mh
Line 1: Line 1:
 +<​code>​
 +select status, ​
 +       ​job_id, ​
 +       ​first_name, ​
 +       ​last_name, ​
 +       ​coalesce(start_date, ​
 +          (select max(end_date)+1 ​
 +            from job_history where employee_id = fe.employee_id),​
 +            hire_date) start_date,
 +       ​end_date
 +       from (
 +SELECT '​H'​ status,
 +       ​employees.employee_id,​
 +       ​JOB_HISTORY.job_id, ​
 +       ​EMPLOYEES.FIRST_NAME, ​
 +       ​EMPLOYEES.LAST_NAME, ​
 +       ​hire_date,​
 +       ​start_date,​
 +       ​end_date
 +FROM EMPLOYEES , JOB_HISTORY ​
 +WHERE ( (EMPLOYEES.EMPLOYEE_ID = JOB_HISTORY.EMPLOYEE_ID) )
 +union
 +select '​A',​
 +       ​employees.employee_id,​
 +       ​job_id, ​
 +       ​first_name, ​
 +       ​last_name, ​
 +       ​hire_date,​
 +       null,
 +       ​null ​
 +from employees
 +) fe
 +--where last_name = '​Kochhar'​
 +order by last_name, first_name, start_date
 +</​code>​
 +
 <​code>​ <​code>​
  ​select * from   ​select * from 
Line 101: Line 137:
  
 </​code>​ </​code>​
 +
 +<​code>​
 +select status, ​
 +       ​job_id, ​
 +       ​first_name, ​
 +       ​last_name, ​
 +       ​coalesce(start_date, ​
 +          (select max(end_date)+1 ​
 +            from job_history where employee_id = fe.employee_id),​
 +            hire_date) start_date,
 +       ​end_date
 +       from (
 +SELECT '​H'​ status,
 +       ​employees.employee_id,​
 +       ​JOB_HISTORY.job_id, ​
 +       ​EMPLOYEES.FIRST_NAME, ​
 +       ​EMPLOYEES.LAST_NAME, ​
 +       ​hire_date,​
 +       ​start_date,​
 +       ​end_date
 +FROM EMPLOYEES , JOB_HISTORY ​
 +WHERE ( (EMPLOYEES.EMPLOYEE_ID = JOB_HISTORY.EMPLOYEE_ID) )
 +union
 +select '​A',​
 +       ​employees.employee_id,​
 +       ​job_id, ​
 +       ​first_name, ​
 +       ​last_name, ​
 +       ​hire_date,​
 +       null,
 +       ​null ​
 +from employees
 +) fe
 +--where last_name = '​Kochhar'​
 +order by last_name, first_name, end_date
 +</​code>​
 +
kurs/sets_gruppenoperatoren.txt ยท Last modified: 2014/09/10 21:22 (external edit)