Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting in blocks
Message
From
02/11/2000 08:50:16
 
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00437050
Message ID:
00437072
Views:
25
Thank fgor reply

I understand the way you suggest.
But in that case is not possible to skip from page 1 to page 9
You do not kwon the lastid from page 8

Kind regards
jan


>There's no simple way to do this. But there is a straight forward method. It requires that you track the first and last sorting items and IDs for the current page of rows.
>
>Let's assume that your sorting by name. To move forward by one page:
>
>SELECT TOP 100 *
>FROM thetable
>WHERE name >= LastNameOnPage
>AND id > LastIDOnPage
>ORDER BY name, id ASC
>
>To move back one page:
>
>SELECT TOP 100 *
>FROM thetable
>WHERE name <= FirstNameOnPage
>AND id < FirstIDOnPage
>ORDER BY name, id DESC
>
>This last set will be sorted backwards so you'll have to resort it or you could do something fancy like:
>
>SELECT a.*
>FROM (
> SELECT TOP 100 *
> FROM thetable
> WHERE name <= FirstNameOnPage
> AND id < FirstIDOnPage
> ORDER BY name, id DESC) AS a
>ORDER BY name, id ASC
>
>
>This ought to get you going in the right direction.
>
>-Mike
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform