Well, with the data you gave:
Quote:
$ db2 "select c1, c2 from test t where c1 = 5"
C1 C2
----------- -----------
5 5
|
Would be the most efficient way. But, I think you are after, even when your C1 column is not numbered sequentially. In that case, I think what you have is the might be the way of going about it. As I write this, causes me to think of something like this as well(completely untested):
Quote:
$ db2 "select c1, c2 from (select c1, c2 from test t order by c1 asc fetch first 5 rows only) as t order by c1 desc fetch first 1 row only"
C1 C2
----------- -----------
5 5
|
Dave Nance