I\'ve tried searching but it\'s likely I\'m using the wrong keywords as I can\'t find an answer.
I\'m trying to find the number of orders that are open between two d
Join Dates
to the result of the join between Employees
and Orders
, then group by dates and employees to obtain the counts, something like this:
SELECT
d.Date,
o.Employee,
COUNT(*) AS count
FROM Employees e
INNER JOIN Orders o ON e.ID = o.Employee
INNER JOIN Dates d ON d.Date BETWEEN o.Opened AND o.Closed
GROUP BY
d.Date,
o.Employee