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