Tuesday, March 10, 2015

List Salesrep Salary Query


SELECT
p.person_id
,p.full_name
,p.employee_number
,p.business_group_id
, (pp.proposed_salary_n * b.pay_annualization_factor) salary
,e.aei_information3 VARIABLE

FROM per_all_people_f p
,per_all_assignments_f a
,per_pay_proposals pp
,per_pay_bases b
,per_assignment_extra_info e

WHERE
NVL (p.effective_start_date, SYSDATE) <= SYSDATE
AND p.person_id = 19637
AND NVL (p.effective_end_date, SYSDATE) >= SYSDATE
AND p.person_id = a.person_id
AND NVL (a.effective_end_date, SYSDATE) >= SYSDATE
AND pp.assignment_id = a.assignment_id
AND ( NVL (pp.date_to, SYSDATE) >= SYSDATE
OR pp.date_to = (SELECT MAX (pp_sub.date_to)
FROM per_pay_proposals pp_sub
WHERE pp_sub.assignment_id = pp.assignment_id)
)
AND b.pay_basis_id = a.pay_basis_id
AND e.assignment_id = a.assignment_id
AND e.information_type = 'SSFT_COMMISSION_PLAN'
AND e.aei_information4 IN
('Commission Direct Selling'
,'Commission Sales Support'
,'Commission Sales Engineers')
AND NVL (TO_DATE (e.aei_information1, 'DD-MON-YYYY'), SYSDATE) <= SYSDATE
AND NVL (TO_DATE (e.aei_information2, 'DD-MON-YYYY'), SYSDATE) >= SYSDATE;



No comments:

Post a Comment