Re: [SQL] How Can I limit the select result ? - Mailing list pgsql-sql

From Maarten Boekhold
Subject Re: [SQL] How Can I limit the select result ?
Date
Msg-id Pine.SUN.3.91.980724095340.4169G-100000@dutepp0.et.tudelft.nl
Whole thread Raw
In response to How Can I limit the select result ?  ("¹Ú¹Ì·æ" <mrpark@tinc.co.kr>)
List pgsql-sql
On Fri, 24 Jul 1998, =?UNKNOWN?Q?=B9=DA=B9=CC=B7=E6?= wrote:

> I want to select like this...
>
> select * from any_table where table_field > any_no limit 10 order by
> table_field DESC;
>
> I want to select more than 1000 rows.
> But, I want to view only 10 from maximum to maximum -10.
>
> How can I ?
>
> I want to make the search engin using Postgresql.
> If more than 10000 rows, there's hard to query, I think...
> Does anybody know about this ?

use cursors:

begin;
declare C cursor for
    select * from any_table
        where table_field > 10
    order by table_field DESC;
move forward 4590 in C;
fetch fetch 10 in C;
end;

I don't know how to move to the end of the result set. Maybe it's possible
to use 'move backward 10 in C' and then 'fetch forward 10 in C', you'll
have to try.

Maarten

_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems  |
|                   Department of Electrical Engineering                    |
|           Computer Architecture and Digital Technique section             |
|                          M.Boekhold@et.tudelft.nl                         |
-----------------------------------------------------------------------------


pgsql-sql by date:

Previous
From: The Web Administrator
Date:
Subject: Sub Queries
Next
From: Guido Piazzi
Date:
Subject: Re: [SQL] How Can I limit the select result ?