Thanks for the input

SELECT * FROM table WHERE id BETWEEN (currentid-100) AND
(currentid+100) is rather obvious and I should have thought of it - an
SQL newbie working late at night and then getting up early with the
problem running around my head....

Howver although that works for the primary column it wont help me when
I am sorted on (say) a names column. In tihs case my primary query
would be sorted by names (SELECT id, names FROM table ORDER BY names)
I would then like to retrieve the 100 records either side of the
current record. The names column may contain duplicates but the id
column is unique. Could something like rowid be used, i.e. is there
some way of identifying the number of the current record with respect
to the current query rather than as an absolute reference?

If so that brings me to a related question. Does sqlite guarantee that
the rows returned by a sorted query on a column that does not contain
unique values will always be the same, i.e. will subsequent queries
return the rows in the same order?
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to