Select
*
From
(
Select
Row_Number() Over(
Order
By
表1.CreateTime
desc
)
as
rowId,
表1.AlumnusID,
表1.[
Name
],
表1.Photo
From
表1
INNER
JOIN
表2
ON
表1.AlumnusID = 表2.AlumnusID
INNER
JOIN
表3
ON
表2.BringUpID = 表3.BringUpID
Where
表1.[
Name
] =
'8888'
)
as
MyTabl
Where
rowId
BetWeen
1
and
20
方法1:
适用于 SQL Server 2000/2005
SELECT TOP 页大小 *
FROM table1
WHERE id NOT IN
(
SELECT TOP 页大小*(页数-1) id FROM table1 ORDER BY id
)
ORDER BY id
方法2:
适用于 SQL Server 2000/2005
SELECT TOP 页大小 *
FROM table1
WHERE id >
(
SELECT ISNULL(MAX(id),0)
FROM
(
SELECT TOP 页大小*(页数-1) id FROM table1 ORDER BY id
) A
)
ORDER BY id
方法3:
适用于 SQL Server 2005
SELECT TOP 页大小 *
FROM
(
SELECT ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,* FROM table1
) A
WHERE RowNumber > 页大小*(页数-1)