What is the Equivalent syntax of mysql “ LIMIT ” clause in SQL Server

前端 未结 3 1603
甜味超标
甜味超标 2021-02-08 11:37

What is the Equivalent syntax of MySQL \" LIMIT \" clause in SQL Server . I would like to use it for doing paging of my results. (want to show records5 to 10 )

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-08 12:01

    The closest thing is TOP:

    Select top 5 * from tablename
    

    You can get a range ( rows 5 - 10)

    SELECT * FROM (
      SELECT TOP n * FROM (
        SELECT TOP z columns      -- (z=n+skip)
        FROM tablename
        ORDER BY key ASC
      )
    )
    

提交回复
热议问题