I have a query that returns the following:
ID Rank 1 1 2 1 3 2 4 3 5 4 6 4 I am trying to use the OFFSET / FETCH NEXT at the end to return the records paged
I.E. if I only want 3 rows per page and I want page 1, I would pass a 1 to @Page, and 3 to @PageRecordCount below, and for page 2, a @Page = 2 to get page 2 and so on...
OFFSET (@Page - 1) * @PageRecordCount ROWS FETCH NEXT @PageRecordCount ROWS ONLY; If I need the full grouping of records for each page, how can I accomplish this?
What I am expecting is as follows: @Page = 1 @PageRecordCount = 3
Return:
ID 1 2 3 4 I want to return the number of groupings, rather than the number of rows. Is this possible?