On 8/6/17 4:03 PM, Edmondo Borasio wrote:
What is the simplest and most efficient way of telling SQLITE to select the
NEXT or the PREVIOUS *progr_no *for a given recurring ID, let's say "john"?
Let's assume that I currently I am at progr_no=5.
I was thinking of maybe looping for a given ID and building an associative
array with also the progr_no, but there must be a more efficient and direct
solution, I guess!
Something like SELECT progr_no FROM table WHERE progr_no > 5 AND ID =
"john" ORDER BY progr_no ASC LIMIT 1
(I think that's correct, doing strictly from memory).
Not sure what the best index would be, probably an index on ID, progr_no
since ID needs an exact match
sqlite-users mailing list