How to get row number in SQLite?
I've read many articles regarding how to use a row number in SQLite but none of them gave me the answer I need. I know how to select row number using this query: SELECT (SELECT COUNT() FROM table WHERE title < t.title OR (title = t.title AND id<t.id)) as rowIndex, t.title FROM table AS t ORDER BY t.title; but if I add COLLATE NOCASE (which I need) at the end of the query then the result is completely different. Fabian Your query contains an error: the alias "ja" is not defined. Try it like this: SELECT ( SELECT COUNT(*) + 1 FROM "table" WHERE title < t.title OR (title = t.title AND id<t.id) )