SELECT t1.ID
, t1.Name
(
SELECT COUNT(t2.ID)
FROM tablename AS t2
WHERE t1.Name = t2.Name
and t2.ID <= t1.ID
) AS 'Visit times'
FROM tablename AS t1;
SELECT t1.ID
, t1.Name
(
SELECT COUNT(t2.ID)
FROM tablename AS t2
WHERE t1.Name = t2.Name
and t2.ID <= t1.ID
) AS 'Visit times'
FROM tablename AS t1;