MySQL - row number in recordset?

前端 未结 2 1246
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 15:15

First of all, I\'m not asking how to get the current row number after the results have been return to you.

I\'m wondering, is it possible to get the row number as on

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 15:53

    select table.*,@rn:=@rn+1 as row_num
    from table,(select @rn:=0) as r order by field_you_like
    

提交回复
热议问题