Re: Selecting a specific row

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: "Cason, Kenny" <kenny(dot)cason(at)boeing(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Selecting a specific row
Date: 2004-08-04 22:30:43
Message-ID: 87657ysfho.fsf@asmodeus.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Cason, Kenny" <kenny(dot)cason(at)boeing(dot)com> writes:

> Is there an easy way to select, say, the 15th row in a table? I can't
> use a sequence number because rows will sometimes be deleted resulting
> in the 15th row now being a different row. I need to be able to select
> the 15th row regardless of whether it is the same 15th row as the last
> select.

You can use LIMIT and OFFSET in your SELECT for this, but bear in mind
that rows are not stored in any guaranteed order, so use ORDER BY if
you need to.

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
--T. J. Jackson, 1863

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Jowett 2004-08-04 22:38:14 Re: [HACKERS] postgres and Jdbc 2.0
Previous Message Bruce Momjian 2004-08-04 22:30:01 Re: Timezone for %t log_line_prefix