oracle11g - Complex SQL Queries (self joins and left joins) -


i have 2 tables department , employees. department has department information , each row different department identified deptid , name deptname. within each row there deptheadid holds employee id of manager department.

employees has employee information each row different employee identified empid, name name , each row has deptid points department table.

i'm trying figure out how find out how list manager name , employee names each department. can list manager id number , employee name going manager id manager name stumping me.

thank help.

it same going employee department.

of course, if use 1 "copy" of employee table, where clause (employeeid = managerid) filter out employees not managers, maybe must use more 1 copy.

select ....     employee empl1, -- use data of employees          department dep, -- join empl1 find employee department          employee empl2, -- join dep manager data 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -