This should work even on back ends that don't handle Top N, but it would still have the problem of needing to look at all the data above (or below) the drawing_code in question. Which brings me back to worrying about time.
>This has to be correct because there is no way of knowing what the top N would be without getting all matching records, ordering them, then returning the TOP N.
>
>I think the idea is good if you can bracket the value in the where clause. For this particular question, the point is moot because his backend DB does not support TOP N clause.
>
>I liked my other solution better that should work for all SQL DBs:
>
>NEXT: select min(drawing_code) from mytable where drawing code > current_code
>PREV: select max(drawing_code) from mytable where drawing code < current_code
>
>Then use the return value to retrieve the data.
>