Advertisement
psi_mmobile

Untitled

Jun 18th, 2020
1,803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 2.32 KB | None | 0 0
  1. SELECT pd.person_id,
  2.   pd.date_day AS "Datum",
  3.   p.vo_person_category_id,
  4.   pd.is_locked,
  5.   p.company_nr AS "Persoon",
  6.   'W' AS "Type",
  7.   wc.short_code AS "Looncode",
  8.   DECODE(p.vo_person_category_id,105360,'IB019120',105369,'PB019120',105362,'WB019120','other') AS "Werf",
  9.   NVL(pd.ref_number_task_code,'980GRP16') AS "Activiteit",
  10.    NULL AS "Type_cpa",
  11.    NULL AS "Km aantal"
  12. FROM pd_trf_day pd,
  13.   person p,
  14.   pd_day pdd,
  15.   work_code wc
  16. WHERE pd.person_id                      = pdd.person_id
  17. AND pd.date_day = pdd.date_day
  18. AND pdd.person_id = p.person_id
  19. AND pd.work_code_id                     = wc.work_code_id
  20. AND wc.work_code_std_id > 100
  21. AND wc.vehicle_owner_id = 101395
  22. AND wc.work_code_std_category_id IN (1,2)
  23.  
  24. UNION
  25.  
  26. SELECT pd.person_id,
  27.   pd.date_day AS "Datum",
  28.   p.vo_person_category_id,
  29.   pd.is_locked,
  30.   p.company_nr AS "Persoon",
  31.   'M' AS "Type",
  32.   NULL AS "Looncode",
  33.   DECODE(p.vo_person_category_id,105360,'IB019120',105369,'PB019120',105362,'WB019120','other') AS "Werf",
  34.   NVL(pd.ref_number_task_code,'980GRP16') AS "Activiteit",
  35.   DECODE(pdd.day_journey_role,'D','C','P','P','DA','A','P') AS "Type_cpa",
  36.   pdd.DECLARED_VEHICLE_KM AS "KM aantal"
  37. FROM pd_trf_day pd,
  38.   person p,
  39.   pd_day pdd,
  40.   work_code wc
  41. WHERE pd.person_id                      = pdd.person_id
  42. AND pd.date_day = pdd.date_day
  43. AND pdd.person_id = p.person_id
  44. AND pd.work_code_id                     = wc.work_code_id
  45. AND wc.work_code_std_id > 100
  46. AND wc.vehicle_owner_id = 101395
  47. AND pdd.DECLARED_VEHICLE_KM IS NOT NULL
  48.  
  49. UNION
  50.  
  51. SELECT pd.person_id,
  52.   pd.date_day AS "Datum",
  53.   p.vo_person_category_id,
  54.   pd.is_locked,
  55.   p.company_nr AS "Persoon",
  56.   'V' AS "Type",
  57.   NULL AS "Looncode",
  58.   DECODE(p.vo_person_category_id,105360,'IB019120',105369,'PB019120',105362,'WB019120','other') AS "Werf",
  59.   NVL(pd.ref_number_task_code,'980GRP16') AS "Activiteit",
  60.   DECODE(pdd.day_journey_role,'D','C','P','P','DA','A','P') AS "Type_cpa",
  61.   pdd.DECLARED_PRIVATE_KM AS "KM aantal"
  62. FROM pd_trf_day pd,
  63.   person p,
  64.   pd_day pdd,
  65.   work_code wc
  66. WHERE pd.person_id                      = pdd.person_id
  67. AND pd.date_day = pdd.date_day
  68. AND pdd.person_id = p.person_id
  69. AND pd.work_code_id                     = wc.work_code_id
  70. AND wc.work_code_std_id > 100
  71. AND wc.vehicle_owner_id = 101395
  72. AND pdd.DECLARED_PRIVATE_KM IS NOT NULL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement