On 28 Aug 2010, at 3:33pm, Paul Sanderson wrote:

> 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?

As far as I know if your column is not guaranteed unique, there's no easy way 
to do that.

> 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?

There is no such promise in the documentation.  You may even find that with the 
current version of SQLite it works fine but a subsequent version breaks it.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to