From: Stuart Rison <rison@biochemistry.ucl.ac.uk>
To: Mark Jewiss <Mark.Jewiss@knowledge.com>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Limit rows
Date: Wed, 29 Sep 1999 17:21:39 +0100 (BST)
Message-ID: <Pine.LNX.4.10.9909291718390.30104-100000@bsmlx17> (raw)
In-Reply-To: <Pine.BSO.4.10.9909291613580.5608-100000@office.knowledge.com>
So long as you have a numerical identifier for the 'first' row you are
interested in you should be able to do something like:
SELECT * FROM TABLE WHERE numerical_field>=23 ORDER BY
numerical_field LIMIT 5;
This will pick the row 23 and the next 4 rows regardless of any gaps in
the sequence.
HTH,
Stuart
On Wed, 29 Sep 1999, Mark Jewiss wrote:
> Hello,
>
> I'm still thinking about ways to extract specific rows of data from a
> table, whilst ignoring others. i.e. I want to see rows 3-7 inclusive from
> a table.
>
> Assume that I don't have a numerical identifier - I do, but I can't use
> that as rows from this table may be deleted at some point, thereby
> knocking the id row out of sequence.
>
> Basically I want to be able to do something like this:
>
> select * from table ignore 10 limit 5;
>
> I can't use cursors, which are ideal for this I know.
>
> Is there such a thing in SQL or pgsql specifically? If not I'll have to
> write something....
>
> Regards,
>
> Mark.
> --
> Mark Jewiss
> Knowledge Matters Limited
> http://www.knowledge.com
>
>
>
>
> ************
>
Stuart C. G. Rison
Department of Biochemistry and Molecular Biology
6th floor, Darwin Building, University College London (UCL)
Gower Street, London, WC1E 6BT, United Kingdom
Tel. 0207 504 2303, Fax. 0207 380 7033
e-mail: rison@biochem.ucl.ac.uk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: rison@biochemistry.ucl.ac.uk, Mark.Jewiss@knowledge.com
Subject: Re: [SQL] Limit rows
In-Reply-To: <Pine.LNX.4.10.9909291718390.30104-100000@bsmlx17>
References: <Pine.BSO.4.10.9909291613580.5608-100000@office.knowledge.com> <Pine.LNX.4.10.9909291718390.30104-100000@bsmlx17>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox