1

在伪代码中,我的意思是,你能做这样的事情吗(类似于 TOP):

SELECT Row 2
*
FROM Table
WHERE Column1 = Condition

我想为测试做点什么——我想不出现实世界的场景。只是好奇是否可能。我在 Interwebz 上找不到任何关于它的信息。

4

3 回答 3

3

这会给你第 9 行:

select top 1 *
from (
    select top 9 *
    from MyTable
    order by 1) as x
order by 1 desc
于 2012-05-31T19:43:04.050 回答
2
SELECT  *
FROM    (
        SELECT  *, ROW_NUMBER() OVER (ORDER BY col2) rn
        FROM    mytable
        WHERE   col1 = condition
        ) q
WHERE   rn = 4
于 2012-05-31T19:43:41.880 回答
1
WITH QUERY AS (
               SELECT *, ROW_NUMBER() OVER(ORDER BY Column1) AS RowNumber
               FROM Table
               )
SELECT * FROM QUERY WHERE ROWNUMBER = N
于 2012-05-31T19:47:16.850 回答