On 11/14/2016 2:23 AM, Mike King wrote:
Thanks. In answer to your question a page of results is displayed in a grid on the screen. The user selects a row. If they then change the sort order I want to show the page that contains the selected row (and reselect it). Each row has a unique ID and i need to know the position in the result set so I can calculate the page.
Unless you sort on a set of fields that together form a unique value (e.g. "order by Value2, ID"), you cannot predict beforehand where a particular row lands, without actually performing the sort and scanning through the resultset.
For example, imagine that, in the limit, all rows have the same value in Value2. If you only do "order by Value2", then the resulting order will be completely indeterminate; there's no telling where a row with a given ID would land.
-- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users