Somewhat of a devils advocate here, but I'm not sure one can order based on JUST data. Take the DATE function, for example. If, by your words, ORDER BY should only act on the data, consider this kind of query:
select ItemName,SoldDate from SoldItemDetails order by SoldDate<date('now','-1 month') desc,SoldDate asc; [untested, but here's the theory] What this theoretical query would do is list all items in the table grouping items sold in the past month at the top of the list, then, order by the date in ascending order. Considering DATE isn't part of the data, you now have to open up the door to judging what should and shouldn't be considered to be evaluated by ORDER BY. On Tue, Aug 25, 2015 at 10:00 PM, James K. Lowden <jklowden at schemamania.org> wrote: > > ORDER BY should evaluate the *data* only. In the case of random(), > like any other function it gets invoked once, by SELECT, and produces a > value. That value is the one that ORDER BY should operate on. > > --jkl > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >