How to select top N from a table

后端 未结 9 830
醉酒成梦
醉酒成梦 2020-12-11 21:18

I have to select the top 25 records from a table according to the column Num.

There are two issues. First, the table is not sorted by Num.

9条回答
  •  旧巷少年郎
    2020-12-11 21:22

    select top 25 *
    from your_table
    order by Num asc
    

    On SQL Server that would select the 25 first records starting from the lowest value of Num. If you need the highest, use "desc" instead of "asc".

提交回复
热议问题