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

From: Guido Piazzi <gpiazzi(at)nemo(dot)it>
To: ¹Ú¹Ì·æ <mrpark(at)tinc(dot)co(dot)kr>
Cc: sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] How Can I limit the select result ?
Date: 1998-07-24 09:16:13
Message-ID: Pine.LNX.3.96.980724111036.130B-100000@ik2gdx.ampr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 24 Jul 1998, ¹Ú¹Ì·æ 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.

Try using a cursor:

begin;
declare bingo cursor for
select * from any_table
where table_field > any_no
order by table_field DESC;
fetch 10 in bingo;
end;

And if I mistyped something... read the man pages.
Regards,
-Guido-

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Shawn T. Walker 1998-07-26 01:46:12 Select Query Help
Previous Message Maarten Boekhold 1998-07-24 07:57:15 Re: [SQL] How Can I limit the select result ?