SQL Experts, Please help!!
512107May 16 2006 — edited May 17 2006Hi
Here is my query:
select
--Element Details:
pet.element_name, pet.element_type_id, pet.reporting_name,
decode(pet.processing_type, 'R', 'Recurring', 'Nonrecurring') "Processing Type",
pet.EFFECTIVE_START_DATE, pet.EFFECTIVE_END_DATE,
--Run Result Details:
prr.run_result_id,
NVL(prrv.RESULT_VALUE, 0)"Extra Mileage Details",
decode(piv.name, 'Pay Value', 'Amount',
'Number of KMs', 'Total Kilometers Covered',
'Vehicle Registration No', 'Vehicle Registration No.')"Input Value",
--Assignment Details:
paa.assignment_id,
--Time Period
ptp.START_DATE, ptp.end_date,
ptp.period_name "Payroll Period"
from
hr.pay_element_types_f pet,
hr.pay_run_results prr,
hr.pay_run_result_values prrv,
hr.pay_input_values_f piv,
hr.pay_assignment_actions assact,
hr.per_all_assignments_f paa,
hr.pay_payroll_actions payroll,
hr.per_time_periods ptp
where
pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
and prr.run_result_id = prrv.run_result_id
and piv.input_value_id = prrv.input_value_id
and assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
and paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
and payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
and ptp.TIME_PERIOD_ID = payroll.time_period_id
and pet.element_name = 'IVTB Extra Mileage'
and ptp.end_date between pet.effective_start_date and pet.effective_end_date
and ptp.end_date between paa.EFFECTIVE_START_DATE and paa.EFFECTIVE_END_DATE
and ptp.end_date between piv.effective_start_date and piv.effective_end_date
and paa.payroll_id != 0
and paa.pay_basis_id != 0
When I get the results, I get the Pay Value, Kilometers and Vehicle Registration no. in rows. They are my 'input values' having different input ids, however, they have same run result id and thus. I want to display them as separate columns each with the heading 'Pay value' , 'Kilometers' etc. and display my run resulyt value below each heading.
Is this possible? Can someone plz guide me?
Thanks in advance.
Regards,
Aparna Gupte