select a.customers_id, count(a.year) as sum_day from (select distinct customers_id, year(date)as y, month(date) as m,day(date) as d from table) a group by a.customers_id
select customers_id,count(distinct date(`date`)) from table1 group by customers_id
(select distinct customers_id, year(date)as y, month(date) as m,day(date) as d from table) a
group by a.customers_id
from table1
group by customers_id