Skip site navigation (1) Skip section navigation (2)

Re: Question about restricting the number of rows returned from a query.

From: Stephen Ingram <ingram(at)samsix(dot)com>
To: Philip Hallstrom <philip(at)adhesivemedia(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Question about restricting the number of rows returned from a query.
Date: 2002-02-20 21:11:10
Message-ID: 20020220211712.ZGRA6925.femail12.sdc1.sfba.home.com@there (view raw or flat)
Thread:
Lists: 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(at)postgresql(dot)org so that your
> > message can get through to the mailing list cleanly

In response to

pgsql-novice by date

Next:From: Stephen IngramDate: 2002-02-20 21:17:16
Subject: Re: Question about restricting the number of rows
Previous:From: Mo HolkarDate: 2002-02-20 21:05:43
Subject: Re: Question about restricting the number of rows

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group