Advertisement
psi_mmobile

Untitled

May 7th, 2024
1,479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 1.02 KB | None | 0 0
  1. SELECT mw.person_id, p.company_nr, mw.date_day, mw.sum_hrd timesheet_lines_hr, ptd.sum_hrd ptd_lines_hr
  2. FROM (SELECT p.person_id,TRUNC(md.date_day) date_day, SUM(mtsl.hrd) sum_hrd FROM mw_time_sheet_line mtsl, mfc_mobile_worker mmw, mw_day md, person p
  3. WHERE mtsl.mfc_mobile_worker_id = mmw.mfc_mobile_worker_id
  4.     AND mmw.erp_id = p.person_id
  5.     AND p.vo_person_category_id = 102503
  6.     AND mtsl.validation_status_id = 48
  7.     AND mtsl.mw_day_id = md.mw_day_id
  8.     AND TRUNC(md.date_day) >= TO_DATE('01/02/2024','DD/MM/YYYY')
  9. GROUP BY p.person_id, TRUNC(md.date_day)) mw,
  10. (SELECT ptd.person_id,TRUNC(ptd.date_day) date_day, SUM(ptd.trf_dhr) sum_hrd FROM pd_trf_day ptd, person p
  11. WHERE ptd.person_id = p.person_id
  12.     AND p.vo_person_category_id = 102503
  13.     AND TRUNC(ptd.date_day) >= TO_DATE('01/02/2024','DD/MM/YYYY')
  14. GROUP BY ptd.person_id, TRUNC(ptd.date_day)) ptd,
  15. person p
  16.     WHERE mw.sum_hrd > ptd.sum_hrd
  17.     AND mw.person_id = ptd.person_id
  18.     AND ptd.person_id = p.person_id
  19.     AND mw.date_day = ptd.date_day;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement