Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

HOW TO FIND THE SUPERVIOSOR NAME

youvasriSep 13 2016 — edited Sep 14 2016

SELECT pos.EMP,POS.EMPID,

pos.salutationtype as "TITLE",

  pos.FULL_NAME    AS EMPLOYEENAME,

    title.TITLENAME  AS DESGINATION,

    grade.gradename as GRADE,

  div.DIVISIONNAME AS DIVISON,

  dep.NAME         AS DEPARTMENT,

   loc.CITY         AS BRANCH,

   --supervisor name

   --supervisor designation

   extract(day from pos.dateofbirth) as  "dd of dob",

   extract(month from pos.dateofbirth) as "mm of dob" ,

   extract(year from pos.dateofbirth) as "year of dob",

  fun.ROLENAME     AS FUNCTION,

--loc.locationname as "REGION",

extract(day from pos.startdate) as  "dd of doj",

   extract(month from pos.startdate) as "mm of doj" ,

   extract(year from pos.startdate) as "year of DOJ",

   addl.martialstatus as "MARITAL STATUS",

   pos.SEX AS "GENDER",

   pos.bloodgroup AS "BLOOD GROUP",

   pos.EMAIL AS "e-MAIL",

FROM posemployees pos

LEFT JOIN premployeeaddl addl

ON pos.employeeid=addl.employeeid

LEFT JOIN prdivision div

ON addl.DIVISIONID = div.DIVISIONID

LEFT JOIN SCMDEPARTMENTS dep

ON addl.DEPARTMENTID = dep.DEPARTMENTID

LEFT JOIN prrole fun

ON addl.ROLEID = fun.ROLEID

LEFT JOIN scmlocations loc

ON addl.LOCATIONID = loc.LOCATIONID

LEFT JOIN prtitle title

ON addl.TITLEID = title.TITLEID

LEFT JOIN prgrade grade

ON addl.gradeid=grade.gradeid

WHERE pos.startdate BETWEEN :startdate AND :enddate;

IN THE ABOVE QUERY I HAVE TO ADD THE SUPERVISOR NAME AND DESIGNATION,

FOR EXAMPLE

--------------------

table structure will be like below

supervisor table:                                                   

  

EMP_idsupervisor
10011002
10021003
10031004
10041006
10051007
10061008
1007109
10081000

Employeemaster tbl

  

Emp_idEmp_name
1001Name_1
1002Name_2
1003Name_3
1004Name_4
1005Name_5
1006Name_6
1007Name_7
1008Name_8
1000Name_9

designation details

  

emp_idDesignation
1001Manager
1002Associate
1003Associate
1004Manager
1005Team lead
1006Manager
1007Manager
1008Associate
1000Team lead

wit the above query i need to include the supervisor details

This post has been answered by Frank Kulash on Sep 13 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 11 2016
Added on Sep 13 2016
5 comments
1,369 views