Here is my table:
table employee (
char(50) name
datetime startdate
datetime finishdate
}
Assume that at least one employee started everyday since the start of the business so that
select distinct startdate from employee
would return every day the business was open. I’ve already provided a query to get every day the business was open, but would it be pair each day with the number of employees that were employed on that day? Essentially I am asking whether it is possible to count the number of employees for which (startdate <= day AND finishdate >= day) is true for each day and return that relation in one query.
1 Answer