Re: get certain # of recs

From: Philip Hallstrom <philip(at)adhesivemedia(dot)com>
To: "Mike S(dot) Nowostawsky" <mikenowo(at)sympatico(dot)ca>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: get certain # of recs
Date: 2001-09-14 21:35:45
Message-ID: 20010914143455.L93708-100000@teak.adhesivemedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Take a look at the LIMIT part of the SELECT statement. in your case you'd
do:

select * from tablename limit 21;

ALthough you'll want to use an ORDER BY otherwise you could get different
results each time..

-philip

On Thu, 13 Sep 2001, Mike S. Nowostawsky wrote:

> How can one select only a certain number of records in Postgres?
>
> In other SQL langs we can use, say, for the first 20 recs:
>
> select * from tablename where rownum < 21;
>
> WHAT should 'rownum' be to make this select work... OR is there a diff
> syntax?
>
> Thx,
> --
> =============================================
> Mike S. Nowostawsky:
> Email: mikenowo(at)sympatico(dot)ca, mikenowo(at)yahoo(dot)ca
> Home Page: http://www3.sympatico.ca/mikenowo/
> Lachine (Montreal), Quebec, Canada
>
>
>
> ---------------------------(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

Browse pgsql-general by date

  From Date Subject
Next Message Jason Earl 2001-09-14 21:36:09 Re: get certain # of recs
Previous Message Jeff Eckermann 2001-09-14 21:33:27 Re: joinning tables