Jay Sprenkle wrote:
My application is geared towards users who want to find a specific name
in a list of names, and then want to have the possibility to scroll
backwards or forwards.  For example, if I search for "Sprenkle" I want
to show the user a window with "Sprenkle" in the middle, preceded by the
50 names before it, and followed by the 50 names after it, and also to
be able to smoothly scroll in either direction.

I know the index contains sufficient data to do this, but there seems to
be no way to use it from SQLite.


Get it in two chunks,

the first 100 names after the name in question:
select x from mytable where Name > 'sprenkle' limit 100

and the 100 names before the name in question:
select x from mytable where Name < 'sprenkle' limit 100 order by x desc


Right, that is the way I ended up doing it. I used "<=" instead of "<" and added an "order by" to the first one ("order is never guaranteed unless specifically declared").

Using a UNION of those two SELECTs does not work in 3.3.4 (bug?). Executing them separately does work.

Thanks,

jp.

Reply via email to