QUESTION POSED ON: 21 June 2004
Using SQL v 8.00, I would like to write a generic SQL statement
that will find the "next record" (based on whatever ORDER BY clause you
specify) from the given key when there is a composite primary key.
Example: Here's my table with two columns:
itemId locId
I01 1
I01 4
I01 10
I2 1
I2 4
Is it possible to write one generic SQL statement that will return the
"next" row (i.e. one row in my result set) when my key is ('I01',4)? It should
return ('I01',10). I've tried to concatenate the fields, but have problems with
left justified integers. Is this possible without using a cursor?
|