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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -