0

I have the below two table. I want to calculate the number of days, Monday-Friday between hire_dt and the end of month. Both counting the Hire_dt and not counting the hire_dt.

id     Hire_dt
 1     9/24/2018

TableB

calendar_dt    day_of_week   EOM           WorkDay    
  09/24/2018     Monday       09/30/2018      1 

Expected Results:

id    Hire_dt      BusinessDaysBetween    BusinessDaysBetween2
 1    09/24/2018       5                         4

Query:

Select last_day(hire-dt) - hire_dt --where to filter out sat and sunday?
from A
John
  • 289
  • 3
  • 14
  • 2
    How are you definig business days - just any weekday (as you onlty referred - m-f, presumably Monday to Friday), or somehow excluding holidays - in which case, do you have another table storing holidays? – Alex Poole Oct 24 '18 at 17:33
  • Not excluding Holidays. Monday-Friday are the business days – John Oct 24 '18 at 17:34
  • 3
    There is no built-in concept of business days. Because it's not just a matter of the weekend, but also public holidays. So each system has to define their own. – APC Oct 24 '18 at 17:35
  • Updated, days between counting only Monday-Friday. – John Oct 24 '18 at 17:37
  • the logic here https://stackoverflow.com/questions/52821072/adding-business-days-in-oracle-sql/52822020#52822020 may be helpful. – Barbaros Özhan Oct 24 '18 at 17:39

0 Answers0