Mysql
 sql >> Database >  >> RDS >> Mysql

come dare un numero all'occorrenza in sql

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;