Q:

Mysql group by day

This is my tables : 
car_event 
  id
  start_date

employee_car_event 
  car_event_id
  employee_id

Some employees works two time on one day. 
In my exemple employee 1 and 2 work the same day two time. 
I want to know how many days works each employees 
I try to do : 
select 

   count(employee_car_event.id) as nbrJour, 
   employee_car_event.employee_id as idEmployee,    
   DATE_FORMAT(car_event.startDate, '%Y%m%d') as gday

 from employee_car_event 
    left join 
    car_event on car_event.id = employee_car_event.car_event_id 
    group by gday, employee_car_event.employee_id

But i have this : 
2 | 1 | 20170320
2 | 2 | 20170320

And i want : 
1 | 1 | 20170320
1 | 2 | 20170320

Thank's a lot for your help

A:

try with this query
select 

   count(distinct employee_car_event.employee_id) as nbrJour, 
   employee_car_event.employee_id as idEmployee,    
   DATE_FORMAT(car_event.startDate, '%Y%m%d') as gday

 from employee_car_event 
    left join 
    car_event on car_event.id = employee_car_event.car_event_id 
    group by gday, employee_car_event.employee_id

