How to get the business days between today and target date
I have a table [Calendar], with columns Calendar Date and Business Day (1 represents a working day, 0 represents a holiday). Now, I have another table [aaa_file] with the column Target Date. How can I calculate the number of working days from today to the Target Date in the [aaa_file] table?
I try the query table, but it can't use "Today"
- SELECT
- a.Target_Date,
- COUNT(c.Calendar_Date) AS Workdays_Count
- FROM
- aaa_file a
- JOIN
- Calendar c ON c.Calendar_Date BETWEEN Today AND a.Target_Date
- WHERE
- c.Business_Day = 1
- GROUP BY
- a.Target_Date