Question: how to calculate business days in sql query?
Answer: Start a loop from one up to the number of days between the start and end dates. Minus one if you exclude the end date. On each iteration, add the current index to the start date. If the result is a weekday, increment a counter of working days.