Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT pd.person_id,
- pd.date_day AS "Datum",
- p.vo_person_category_id,
- pd.is_locked,
- p.company_nr AS "Persoon",
- 'W' AS "Type",
- wc.short_code AS "Looncode",
- DECODE(p.vo_person_category_id,105360,'IB019120',105369,'PB019120',105362,'WB019120','other') AS "Werf",
- NVL(pd.ref_number_task_code,'980GRP16') AS "Activiteit",
- NULL AS "Type_cpa",
- NULL AS "Km aantal"
- FROM pd_trf_day pd,
- person p,
- pd_day pdd,
- work_code wc
- WHERE pd.person_id = pdd.person_id
- AND pd.date_day = pdd.date_day
- AND pdd.person_id = p.person_id
- AND pd.work_code_id = wc.work_code_id
- AND wc.work_code_std_id > 100
- AND wc.vehicle_owner_id = 101395
- AND wc.work_code_std_category_id IN (1,2)
- UNION
- SELECT pd.person_id,
- pd.date_day AS "Datum",
- p.vo_person_category_id,
- pd.is_locked,
- p.company_nr AS "Persoon",
- 'M' AS "Type",
- NULL AS "Looncode",
- DECODE(p.vo_person_category_id,105360,'IB019120',105369,'PB019120',105362,'WB019120','other') AS "Werf",
- NVL(pd.ref_number_task_code,'980GRP16') AS "Activiteit",
- DECODE(pdd.day_journey_role,'D','C','P','P','DA','A','P') AS "Type_cpa",
- pdd.DECLARED_VEHICLE_KM AS "KM aantal"
- FROM pd_trf_day pd,
- person p,
- pd_day pdd,
- work_code wc
- WHERE pd.person_id = pdd.person_id
- AND pd.date_day = pdd.date_day
- AND pdd.person_id = p.person_id
- AND pd.work_code_id = wc.work_code_id
- AND wc.work_code_std_id > 100
- AND wc.vehicle_owner_id = 101395
- AND pdd.DECLARED_VEHICLE_KM IS NOT NULL
- UNION
- SELECT pd.person_id,
- pd.date_day AS "Datum",
- p.vo_person_category_id,
- pd.is_locked,
- p.company_nr AS "Persoon",
- 'V' AS "Type",
- NULL AS "Looncode",
- DECODE(p.vo_person_category_id,105360,'IB019120',105369,'PB019120',105362,'WB019120','other') AS "Werf",
- NVL(pd.ref_number_task_code,'980GRP16') AS "Activiteit",
- DECODE(pdd.day_journey_role,'D','C','P','P','DA','A','P') AS "Type_cpa",
- pdd.DECLARED_PRIVATE_KM AS "KM aantal"
- FROM pd_trf_day pd,
- person p,
- pd_day pdd,
- work_code wc
- WHERE pd.person_id = pdd.person_id
- AND pd.date_day = pdd.date_day
- AND pdd.person_id = p.person_id
- AND pd.work_code_id = wc.work_code_id
- AND wc.work_code_std_id > 100
- AND wc.vehicle_owner_id = 101395
- AND pdd.DECLARED_PRIVATE_KM IS NOT NULL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement