Re: [SQL] How Can I limit the select result ?

Поиск
Список
Период
Сортировка
От Maarten Boekhold
Тема Re: [SQL] How Can I limit the select result ?
Дата
Msg-id Pine.SUN.3.91.980724095340.4169G-100000@dutepp0.et.tudelft.nl
обсуждение исходный текст
Ответ на How Can I limit the select result ?  ("¹Ú¹Ì·æ" <mrpark@tinc.co.kr>)
Список 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 по дате отправления:

Предыдущее
От: The Web Administrator
Дата:
Сообщение: Sub Queries
Следующее
От: Guido Piazzi
Дата:
Сообщение: Re: [SQL] How Can I limit the select result ?