Moudiz
Moudiz

Reputation: 7377

Sybase shows rows between 100 and 150

How to select in Sybase data between rows, e.g.: from row 100 to row 150

TOP 50 will give me from 0 to 50, but I want from 100 to 150.

This link shows for Oracle and MySQL, but not for sybase.

The @@rowcount will specify the count, or am I wrong?

Upvotes: 0

Views: 916

Answers (1)

Veljko89
Veljko89

Reputation: 1953

It would go something like this ....

    select top 50 * from (
        select top 150 * from dbo.YourTable
    ) src order by ID desc

You want to select 150 rows order by desc,

So it would go 150, 149 ... 3, 2, 1 ... from that you will select top 50 ... meaning from 150 to 100.

Upvotes: 1

Related Questions