﻿_id	select distinct
1	gn_person_qu.idnumber(rq.candidate) idi, gn_person_qu.lastname(rq.candidate)lnam,
2	gn_person_qu.firstname(rq.candidate)fnam,
3	gn_sex_qu.DESCRIPTION(  gn_person_qu.SEX(rq.candidate)   )gender,
4	gn_person_qu.BIRTHCOUNTRY(rq.candidate) bcuntry, gn_country_qu.DESCRIPTION(gn_person_qu.BIRTHCOUNTRY(rq.candidate))bcoundes,
5	 ac.CITY_CODE, ap_city_qu.DESCRIPTION(ac.CITY_CODE)citdes,
6	rq.unit,REPLACE(ap_unit_qu.lastname(rq.unit),',','')uniname,
7	ap_unit_tree_qu.GetFacultyOfUnit(rq.unit) fac,
8	REPLACE(ap_unit_qu.lastname(ap_unit_tree_qu.GetFacultyOfUnit(rq.unit)),',','')facname,
9	rq.GRADE,rq.FINAL_STEP_IN_GRADE  darga ,rq.STATUS_IN_STEP mamad,
10	ap_grade_step_status_qu.DESCRIPTION(rq.GRADE,rq.FINAL_STEP_IN_GRADE ,rq.STATUS_IN_STEP)grdes
11	""
12	from ap_request rq, ap_candidate ac
13	where
14	rq.grade in(22, 49, 50, 62, 18,21,  23,  44, 45, 92, 94, 43   ) 
15	and 
16	rq.REQUEST_STATUS = 40 and rq.new_changed_request <> 5  and
17	 rq.to_DATE >= to_date('01/10/2017','dd/mm/YYYY')
18	 and rq.from_DATE >= to_date('30/09/2018','dd/mm/YYYY') and
19	rq.candidate = ac.candidate
