select
    a.id,
    count(b.id)
from
    user_visit_log a
    left join user_visit_log b on a.id = b.id
    and timestampdiff (day, a.visit_date, b.visit_date) < 3
    and timestampdiff (day, a.visit_date, b.visit_date) >= 1
group by
    a.id
order by
     a.id