SQLite Forum

Inconsistent behavior when using nth_value and COUNT
Login
STMT 2 should raise an error in the ORDER BY clause.  However, it
recognizes that the ORDER BY clause is superfluous and deletes it prior
to getting to the point where it sees that the ORDER BY clause contains
an illegal aggregation function.  Hence, the error never gets raised.

We are not sure what, if anything, should be done about this.  In any event,
it is a low-priority issue.