Re: Question about restricting the number of rows returned from a query. - Mailing list pgsql-novice

From Stephen Ingram
Subject Re: Question about restricting the number of rows returned from a query.
Date
Msg-id 20020220211712.ZGRA6925.femail12.sdc1.sfba.home.com@there
Whole thread Raw
In response to Re: Question about restricting the number of rows returned from a  (Philip Hallstrom <philip@adhesivemedia.com>)
List pgsql-novice
On Wednesday 20 February 2002 03:50 pm, Philip Hallstrom wrote:
> See the LIMIT and OFFSET options in the SELECT command in the manual.
>

Thanks Philip.  I did *try* and get onto the postgres sites, but it
kept timing out, so I lazily asked here. Sorry.

And now I found this is psql...  nice!

Thanks again,

steve


lazygitdb=# \h select
Command:     SELECT
Description: Retrieves rows from a table or view
Syntax:
SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
    * | expression [ AS output_name ] [, ...]
    [ FROM from_item [, ...] ]
    [ WHERE condition ]
    [ GROUP BY expression [, ...] ]
    [ HAVING condition [, ...] ]
    [ { UNION | INTERSECT | EXCEPT [ ALL ] } select ]
    [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
    [ FOR UPDATE [ OF tablename [, ...] ] ]
    [ LIMIT { count | ALL } [ { OFFSET | , } start ]]

where from_item can be:

[ ONLY ] table_name [ * ]
    [ [ AS ] alias [ ( column_alias_list ) ] ]
|
( select )
    [ AS ] alias [ ( column_alias_list ) ]
|
from_item [ NATURAL ] join_type from_item
    [ ON join_condition | USING ( join_column_list ) ]



> -philip
>
> On Wed, 20 Feb 2002, Stephen Ingram wrote:
> > Hi,
> >
> > If I am running a query I know could return 1000's of rows;
> > is there a PG way to say to just return the first, say, 50 rows?
> >
> > cheers
> >
> > steve
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo@postgresql.org so that your
> > message can get through to the mailing list cleanly

pgsql-novice by date:

Previous
From: Tuna Chatterjee
Date:
Subject: Re: Question about restricting the number of rows returned
Next
From: Tuna Chatterjee
Date:
Subject: 7.2 upgrade