Want Row Number on Group of column in MY SQL?

后端 未结 5 1870
不思量自难忘°
不思量自难忘° 2020-12-20 19:34

I have one table in MYSQL It has data like

Id Name 
1  test
1  test
1  test123
2  test222
3  test333

I want the data like

Id Name     RowN         


        
5条回答
  •  轮回少年
    2020-12-20 20:30

    select id, name, (select count(*) + 1 from table as i where i.id = p.id and i.id < p.id ) from table p;
    

提交回复
热议问题