On 3/2/15, Igor Tandetnik <igor at tandetnik.org> wrote: > On 3/2/2015 4:48 AM, Jan Asselman wrote: >> But when I step over the rows they are not returned in primary key sort >> order. Why is this? > > Because you didn't add an ORDER BY clause. If you need a particular sort > order, specify it with ORDER BY. >
Igor is 100% correct - I should have been emphatic about this in my reply: If you need output in a particular order ALWAYS ALWAYS ALWAYS use an ORDER BY clause. No exceptions. If SQLite can provide the output in the requested order using an index, it will. Never try to out-smart the query planner. Doing so only leads to needless pain and suffering. -- D. Richard Hipp drh at sqlite.org