declare @page int=3;
declare @perpage int=20;
SELECT UserID, PostTime, rid FROM (
SELECT UserID, PostTime, rid=ROW_NUMBER() OVER(ORDER BY PostTime) FROM (
SELECT UserID,PostTime,rowid=ROW_NUMBER() OVER(PARTITION BY UserID ORDER BY PostTime DESC)
FROM Activity..OnlineMatch2th
WHERE PostDate='2011-8-11'
)t WHERE rowid=1
)t2 WHERE rid BETWEEN (@page-1)*@perpage+1 AND @page*@perpage