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.

Thanks,

Kenny Cason
The Boeing Company

Wed, 4 Aug 2004 15:11:53 -0700
"Cason, Kenny" <kenny.cason@boeing.com>
Selecting a specific row
"Cason, Kenny" <kenny.cason@boeing.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

Wed, 04 Aug 2004 18:30:43 -0400
Doug McNaught <doug@mcnaught.org>
Re: Selecting a specific row
On Wed, 2004-08-04 at 16:11, Cason, Kenny wrote:
> 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.

SQL itself has no natural ordering, so I'll assume you're doing
something like this:

select * from table order by seq_field

Just add offset and limit to the end:

select * from table order by seq_fields limit 1 offset 15;


Wed, 04 Aug 2004 16:39:01 -0600
"Scott Marlowe" <smarlowe@qwest.net>
Re: Selecting a specific row