How to select last N records from a table in mysql

后端 未结 4 1476
半阙折子戏
半阙折子戏 2021-01-03 09:11

This code can be used to select the first ten records from a table in mysql. How can I do the same to display last ten records from a table which has 1000 records. I want to

4条回答
  •  感情败类
    2021-01-03 09:59

    You can use ROW_NUMBER() clause for this, this will be helpful for you

    select top "N" * from (select ROW_NUMBER() OVER(Order by Col_Name desc) as RowNo,* from Table_Name) Table_Name

提交回复
热议问题