Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT mw.person_id, p.company_nr, mw.date_day, mw.sum_hrd timesheet_lines_hr, ptd.sum_hrd ptd_lines_hr 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
- WHERE mtsl.mfc_mobile_worker_id = mmw.mfc_mobile_worker_id
- AND mmw.erp_id = p.person_id
- AND p.vo_person_category_id = 102503
- AND mtsl.validation_status_id = 48
- AND mtsl.mw_day_id = md.mw_day_id
- AND TRUNC(md.date_day) >= TO_DATE('01/02/2024','DD/MM/YYYY')
- GROUP BY p.person_id, TRUNC(md.date_day)) mw,
- (SELECT ptd.person_id,TRUNC(ptd.date_day) date_day, SUM(ptd.trf_dhr) sum_hrd FROM pd_trf_day ptd, person p
- WHERE ptd.person_id = p.person_id
- AND p.vo_person_category_id = 102503
- AND TRUNC(ptd.date_day) >= TO_DATE('01/02/2024','DD/MM/YYYY')
- GROUP BY ptd.person_id, TRUNC(ptd.date_day)) ptd,
- person p
- WHERE mw.sum_hrd > ptd.sum_hrd
- AND mw.person_id = ptd.person_id
- AND ptd.person_id = p.person_id
- AND mw.date_day = ptd.date_day;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement