Можете да използвате подзаявка
Примерна таблица
create table visits (day int, userid char(1));
insert visits values
(1,'a'),
(1,'b'),
(2,'b'),
(3,'a'),
(4,'b'),
(4,'c'),
(5,'d');
Заявката
select d.day, (select count(distinct userid) from visits where day<=d.day)
from (select distinct day from visits) d