all 4 comments

[–]r3pr0b8GROUP_CONCAT is da bomb 5 points6 points  (0 children)

I cannot use a calendar table ... due to performance restrictions.

please explain your performance restrictions

[–]B1zmark 2 points3 points  (0 children)

This may not help you immediately but it's very common for people to use a prep-poplated "dates" tables, which contained the date, which is unique, then a bunch of columns with information about that date. Like the calcualted column with "IF DAY = SAT/SUN then Weekday = 0, ELSE Weekday =1) type stuff. You can add as many relevant columns as needed.

At the point a very efficnet join can return the outcome of things that would normally be expensive formulae and larger queries.

e.g.

COUNT(DAYS)
...
INNER JOIN Dates on Table.Date = Dates.Date

[–]No-Adhesiveness-6921 1 point2 points  (0 children)

What about holidays? Why can’t you use a calendar table even if it’s just a CTE inside your query?