SQLite Forum

SELECT skips empty fields ?
Login
> "ORDER BY (title, id) DESC" does not seem to work. Yet, I do not get an error.

this throws the error "row value misused", which is correct.

 >  What is the above ORDER BY supposed to be doing ?

You mean the ORDER BY which contains a misused row value?  It should be generating an error message because it is invalid.

 > This seems to work well as long as the selected and sorted on field (title) contains something. When it contains nothing (returning empty strings) all the empty fields are skipped.

Are you sure that you don't mean NULL rather than an empty string?

The obverse of:

 > SELECT * FROM moz_places WHERE (title, id) >= (?1, ?9) ORDER BY title, id LIMIT 34;

would be:

SELECT * FROM moz_places WHERE (title, id) <= (?1, ?9) ORDER BY title desc, id desc LIMIT 34