SQLite Forum

ORDER BY out of order. Is this a bug or expected?
Login
You have correctly surmised why the first result set is ordered as you show.

Answering your question: Your alias refers to the expression whose type is text. This is all as it should be and is documented.