SQL Invalid Identifier Error (INNER JOIN) [duplicate]

0
  • Select a list of employees who switched from office to department (% with%), the list should contain the registration and name of the employee, the name of the department and position that worked, and also the start and end date ( job_history and start_date ), sort by start date.
  • Make a select with inner join using where and another select with join ... on.

    A:

    select 
        E.employee_id, 
        E.first_name||' '||E.last_name "Nome", 
        D.department_name, 
        J.job_title, 
        JH.start_date, 
        JH.end_date
    from employees E, job_history JH, jobs J
    inner join departments D on E.employee_id = JH.employee_id 
                             and D.department_id = JH.department_id 
                             and J.job_id = JH.job_id
    order by JH.start_date;
    
      

    ORA-00904: "JH". "JOB_ID": Invalid identifier   00904. 00000 - "% s: invalid identifier"   * Cause:
      * Action:   Error in line: 18 Column: 114

        
    asked by anonymous 29.08.2017 / 23:34

    1 answer

    0

    Try to make a join for each relation, type.

    select 
    E.employee_id, 
    E.first_name||' '||E.last_name "Nome", 
    D.department_name, 
    J.job_title, 
    JH.start_date, 
    JH.end_date
    from 
    employees E inner join departments D on E.department_id = D.department_id,
    job_history JH inner join departments D on JH.department_id = 
    D.department_id, jobs J inner join departments D on J.department_id = 
    D.department_id,
    .
    .
    .
    order by JH.start_date;
    
        
    30.08.2017 / 03:14