On 06-05-2012 19:34, William Parsons wrote: > In my application, I've encountered a problem with ordering where the result > doesn't match what I would have expected, and would like some clarification. > The issue is illustrated by the following: > > % sqlite3 :memory: > SQLite version 3.7.10 2012-01-16 13:28:40 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> create table x(a int, b int unique); > sqlite> insert into x(a) values (1); > sqlite> insert into x(a) values (4); > sqlite> insert into x(a) values (3); > sqlite> insert into x(a) values (5); > sqlite> insert into x(b) values (6); > sqlite> insert into x(b) values (8); > sqlite> insert into x(b) values (7); > sqlite> insert into x(a) values (2); > sqlite> select * from x; > 1| > 4| > 3| > 5| > |6 > |8 > |7 > 2| > sqlite> select * from x order by b, a; > 1| > 4| > 3| > 5| > 2| > |6 > |7 > |8 > sqlite> .e > > Why aren't the numbers sorted as I would have expected? Note that if I > remove > the unique constraint from column b it works as expected. >
quote from: http://en.wikipedia.org/wiki/Order_by The SQL standard's core functionality does not explicitly define a default sort order for Nulls. So, if it is not defined how to sort column b, how can anyone correctly sort the column a? _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users