join 3 tables
633384Dec 9 2009 — edited Dec 9 2009Hi,
I have 3 tables which I need to join to get my result set.
First table (Staff) has staff first name, last name and identifier and end_dt (end_dt is null when case is open)
Second table (staff caseload) has staff identifier and case load.
Third table (caseload) has case load and staff identifier information and end_dt
The most current workload information is in the first staff table.
I need the first name, last name, identifier but only cases that have an end_dt of null in the staff table.
Any help is greatly appreciated.
My query is returning rows from the caseload table as well.
select distinct staff.last_nm, staff.first_nm, caseload.IDENTFR_NM,
MAX(to_char(staff_caseload.start_dt, 'mm/dd/yyyy hh:mi')) OVER(PARTITION BY caseload.identfr_nm )
from staff_caseload, caseload, staff, caseload
where (staff_caseload.FKidentifier = caseload.identifier
and sraff_caseload.FKidentifier = staffT.IDENTIFIER
and staff.end_dt is null
and caseload.end_dt is null
Thank you.
Shobha