1
The ACESSOBROA_NOVO table records the access of company employees whenever they go through a turnstile.
I need to do a query in this table that lists the name of the employees and count the days worked in a period, for example, of 5 days.
As in this table are recorded every time he entered and left the company in 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
As I only need to check if the employee was present on the days requested and not count how many times he passed the turnstile.
Follow a sample of the table:
tried to use COUNT(DISTINCT DATAR) ??
– RafaelTSCS