Good day,
The "SELECT" below shows the number of employees and their arrival and departure times.
In this data, I need to find out the total number of employees (COUNT) at each time (I do not need to deal with seconds). How many people worked at the same time in a given period of time.
Example:
SELECT
linka.xLinka
, linka.xDoklad
, zam.xPracovnik
, FORMAT(zam.xCasOd, 'HH:mm') as cas_od
, FORMAT(zam.xCasDo, 'HH:mm') as cas_do
FROM [K2CA_CA].[dbo].[_OV_Data01] as linka
LEFT OUTER JOIN dbo._OV_Data03 as zam ON zam.xLinka = linka.xLinka and zam.xDoklad = linka.xDoklad
WHERE linka.xRok = 2021
--AND linka.xDen >= '2021-10-20' and linka.xDen <= '2021-10-26'
AND (zam.xPozice like '