On Fri, Aug 15, 2003 at 13:42:23 -0400, Merlin Moncure <merlin.moncure@rcsonline.com> wrote:
>
> Example:
> I have a table t with columns a, b, c. I have values a1, b1, c1 for
> those columns and would like to know the next value in the table when
> ordered by a, b. I have values a1, b1, and oid1 and would like to find
> the very next record in the table (essentially looking for the next
> record in the index).
>
> I have two solutions: one with 'or' logic and one with 'and' logic.
> Note: if the index we are scanning has the unique constraint, the oid
> part of the logic (and the index) can be left out.
>
How about something like the following:
select * from t
where a >= a1 and b >= b1 order by a, b limit 1 offset 1;