Re: [SQL] setting select limit?

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Frank Morton <fmorton(at)base2inc(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] setting select limit?
Date: 1999-02-11 02:10:06
Message-ID: Pine.GSO.3.96.SK.990211050723.9050E-100000@ra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You need v6.4.2-feature-patch which implement LIMIT option:

LIMIT This is a new option to the SELECT statement, telling
the database that only some of the rows selected
should be returned in the result set.

The added syntax of the LIMIT option is:

SELECT ... [LIMIT {ALL | lim} [, off]];
or
SELECT ... [LIMIT {ALL | lim}] [OFFSET off];

where lim is a positive integer value greater than
zero and off is an integer value greater or equal to
zero. Both values can be specified as Parameters when
using the server programming interface (SPI). In this
case, a zero value given in the argument for the lim
parameter means ALL.

You can find it in patches directory

Regards,

Oleg

On Wed, 10 Feb 1999, Frank Morton wrote:

> Date: Wed, 10 Feb 1999 20:36:57 -0500
> From: Frank Morton <fmorton(at)base2inc(dot)com>
> To: pgsql-sql(at)postgreSQL(dot)org
> Subject: [SQL] setting select limit?
>
> If a select is going to match 1000 records, but I only want to
> select the first 25, I thought I could:
>
> select * from table limit 25;
>
> But I guess I can't. How do I limit the query? I've search
> around with no results. Thanks.
>
>
>
>

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bob Dusek 1999-02-11 08:32:01 Re: [GENERAL] Select max field
Previous Message Frank Morton 1999-02-11 01:36:57 setting select limit?