Simon, assume the sql will be input by the user. I suppose I could give them an error message but it would be good to just add the ‘calculated’ order by to the sql and display that.
________________________________ From: sqlite-users <[email protected]> on behalf of Simon Slavin <[email protected]> Sent: Saturday, March 24, 2018 6:04:38 PM To: SQLite mailing list Subject: Re: [sqlite] Determine sort order of query On 24 Mar 2018, at 6:00pm, x <[email protected]> wrote: > Thanks for the reply Richard. I don’t suppose it matters to me that it may > change from one day to the next or one connection to another as long as I can > determine the order it will be returned in milliseconds before the first > sqlite3_step. Can't be done without putting enough analysis in your program to completely understand the output of EXPLAIN QUERY PLAN. And the output of that statement does not have a fixed form: lines can go up or down, ANALYZE can change what happens, whether a table is empty or has data can change what happens. If you want to be able to predict the order of results from a SELECT, set it using ORDER BY. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

