2012-01-26 21 views
-2
select ppf.employee_number , ABA.absence_days 
from  PER_ABSENCE_ATTENDANCES ABA, apps.PER_ALL_PEOPLE_F ppf 
where ppf.person_id = aba.person_id 

我需要得到所有員工人數和無天他們的經理下下(表parent_position_id & subordinate_position_idper_pos_structure_elementsSQL Oracle人力資源管理

e.g parent_position_id = 12541

我怎樣才能將它們集成?

+0

拿什麼HRMS? –

+0

人力資源管理系統我猜。 –

+0

這是Oracle默認的HR模式? –

回答

1

像這樣的東西?

select ppf.employee_number , ABA.absence_days 
from  PER_ABSENCE_ATTENDANCES ABA 
inner join apps.PER_ALL_PEOPLE_F ppf 
    on ppf.person_id = ABA.person_id 
inner join per_pos_structure_elements 
    on ppf.subordinate_position_id = ppf.person_id 
where ppf.parent_position_id = 12541 
+1

+1使用顯式連接。 – Aaron

+0

@littlegreen不喜歡這個,但任何方式謝謝:)因爲person_Id值不等於subordinate_position_id –

0
SELECT employee_number, NVL(a.absence_days,0) 
FROM (SELECT ppf.employee_number employee_number , ABA.absence_days absence_days 
     FROM apps.PER_ALL_PEOPLE_F ppf 
     LEFT OUTER JOIN PER_ABSENCE_ATTENDANCES ABA ON ppf.person_id = ABA.person_id 
    ) a 
INNER JOIN per_pos_structure_elements pps 
    ON pps.subordinate_position_id = ppf.person_id AND ppf.parent_position_id = 12541 
+0

person_Id值不等於subordinate_position_id,並且以任何方式 –