The ACESSOBROA_NOVO table registers the access of company employees whenever they go through a ratchet.
I need to do a query in this table that lists the names of the employees and counts the days worked in a period of, for example, 5 days.
As this table is registered every time he entered and left the company the same day the following query does not work:
SELECT distinct NOME_FUN, EMPRESA,count(DATAR) as 'dias trabalhdos'
FROM [RDO].[dbo].[ACESSOBROA_NOVO]
where CC=11396 and DATAR between '2015-09-21' and '2015-09-21'
group by NOME_FUN, empresa
Because I need only verify that the employee was present on the days requested and not count how many times he spent in the ratchet.
Here is a sample of the table: