07-31-2023, 08:00 AM
I have been trying to understand a little bit about how to implement custom paging in SQL, for instance reading [articles like this one][1].
I have the following query, which works perfectly. But I would like to implement paging with this one.
SELECT TOP x PostId FROM ( SELECT PostId, MAX (Datemade) as LastDate
from dbForumEntry
group by PostId ) SubQueryAlias
order by LastDate desc
**What is it I want**
I have forum posts, with related entries. I want to get the posts with the latest added entries, so I can select the recently debated posts.
Now, I want to be able to get the "top 10 to 20 recently active posts", instead of "top 10".
**What have I tried**
I have tried to implement the ROW functions as the one in the article, but really with no luck.
Any ideas how to implement it?
[1]:
I have the following query, which works perfectly. But I would like to implement paging with this one.
SELECT TOP x PostId FROM ( SELECT PostId, MAX (Datemade) as LastDate
from dbForumEntry
group by PostId ) SubQueryAlias
order by LastDate desc
**What is it I want**
I have forum posts, with related entries. I want to get the posts with the latest added entries, so I can select the recently debated posts.
Now, I want to be able to get the "top 10 to 20 recently active posts", instead of "top 10".
**What have I tried**
I have tried to implement the ROW functions as the one in the article, but really with no luck.
Any ideas how to implement it?
[1]:
[To see links please register here]