0

私はコーディングが初めてで、SQL コマンドを準備していましたが、ステップで行き詰まりました。以下は、メインの SQL クエリです。

select 
distinct 
hap.position_code as RequisitionNumber, 
COALESCE(hap.attribute10,'UNIVERSAL') as RequisitionType, hap.name as 
RequisitionTitle, 
paam1.job_id as RequisitionTemplate, COALESCE(hap.attribute11,'1') as 
NumberToHire, 

pu.username as HiringManagerLogin, 

paam1.job_id as JobField, 
hap.full_part_time as Schedules, hap.position_code as PositionCode  
from hr_all_positions hap, per_all_assignments_m paam1, per_users pu 
where hap.position_id = paam1.position_id
and hap.position_id in
(
select distinct paam.position_id from per_all_assignments_m paam, 
per_periods_of_service ppos 
where paam.person_id = ppos.person_id and paam.position_id is not null and 
ppos.actual_termination_date >= sysdate
)

上記のクエリでは、下に添付されている別のクエリから pu.username の値を取得しています。

select pu.username from per_users pu where person_id = (
select pmhd.manager_id from PER_MANAGER_HRCHY_DN pmhd, 
per_periods_of_service ppos 
where pmhd.person_id = ppos.person_id and pmhd.IMMEDIATE_REPORTEE_ASG_ID is 
not null 
and pmhd.EFFECTIVE_END_DATE = ppos.actual_termination_date and 
ppos.actual_termination_date >= sysdate 
and pmhd.person_id = (select distinct paam.person_id from 
per_all_assignments_m paam, per_periods_of_service ppos 
where paam.person_id = ppos.person_id and paam.position_id is not null and 
ppos.actual_termination_date >= sysdate) 
)

今、私は以下のように両方のクエリに参加すると:

select 
distinct 
hap.position_code as RequisitionNumber, 
COALESCE(hap.attribute10,'UNIVERSAL') as 
RequisitionType, hap.name as RequisitionTitle, 
paam1.job_id as RequisitionTemplate, COALESCE(hap.attribute11,'1') as 
NumberToHire, 

pu.username as HiringManagerLogin, 

paam1.job_id as JobField, 
hap.full_part_time as Schedules, hap.position_code as PositionCode  
from hr_all_positions hap, per_all_assignments_m paam1, per_users pu 
where hap.position_id = paam1.position_id and paam1.person_id = pu.person_id
and pu.person_id = (
select pmhd.manager_id from PER_MANAGER_HRCHY_DN pmhd, per_periods_of_service 
ppos 
where pmhd.person_id = ppos.person_id and pmhd.IMMEDIATE_REPORTEE_ASG_ID is 
not null 
and pmhd.EFFECTIVE_END_DATE = ppos.actual_termination_date and 
ppos.actual_termination_date >= sysdate 
and pmhd.person_id = (select distinct paam.person_id from 
per_all_assignments_m 
paam, per_periods_of_service ppos 
where paam.person_id = ppos.person_id and paam.position_id is not null and 
ppos.actual_termination_date >= sysdate) 
)
and hap.position_id in
(
select distinct paam.position_id from per_all_assignments_m paam, 
per_periods_of_service ppos 
where paam.person_id = ppos.person_id and paam.position_id is not null and 
ppos.actual_termination_date >= sysdate
)

試しています これは Oracle データベースです データが出力されません。理由がわかりません。

私を助けてください !!

前もって感謝します、シヴァム

4

1 に答える 1