-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
What do you mean by "next record"? There is no order to the rows in a
table. The only order is imposed by the ORDER BY clause in a query, or
implied in the criteria (the WHERE clause) of the query.
If by "next" you mean the next ID number in numerical order; and, your
example would mean that ID is 900 would be the "next" row with a Level
of -1, then try this:
SELECT ID, Description, Level
FROM Table
WHERE ID >= 600
AND ID < (SELECT MIN(ID) FROM Table
WHERE ID > 600 AND Level = -1)
The "next" row is implied in the subquery.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQ+kDNoechKqOuFEgEQKuygCdFd7x1lXTZEUNDDB9Gp31SG VUrBkAn1Hp
q3IbP1S7KFWPMFfjbWhFxl00
=3LC+
-----END PGP SIGNATURE-----
jibber wrote:
I have an application that stores data using iterators (as below)
ID Description Level
600 Demolition -1
670 Demo Exterior Flat Work 0
675 Remove Foundation Walls 0
680 Remove Concrete Stoops/Steps 0
900 Concrete Curb Cutting & Coring -1
910 Core Through Existining 0
I want to retreive the data from 0600 upto the next record with a
"Level = -1."
SELECT ID, Description, Level
FROM Table
WHERE ID > 600 but < Next Record with "Level= -1"