Oracle SQL missing keyword



  • Recently started with Oracle sql and I really can't understand what I'm doing wrong

    Select  phones
    From employees 
    left join
    (SELECT 
     Employees.manager_id
    ,COUNT(employees.employee_id)
    From employees 
    Group by employees.manager_id) AS "emc" on employees.manager_id = emc.manager_id
    

    It returns error 00905 missing keyword and that "emc" is not colored like the other aliases but I have no idea why.



  • with emc as (SELECT Employees.manager_id ,COUNT(employees.employee_id)
                  From employees Group by employees.manager_id) 
    Select phones From employees
    left join emc
        on employees.manager_id = emc.manager_id;
    

    or

    Select phones From employees left join
    SELECT Employees.manager_id ,COUNT(employees.employee_id)
    From employees Group by employees.manager_id emc
    on employees.manager_id = emc.manager_id
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2