Skip to content Skip to sidebar Skip to footer

Why Is The Order By Not Working In A Sqlite Query

Sqlite table creation in Android: // Contacts table name private static final String TABLE_CHAL = 'CD'; // Contacts Table Columns names private static final String KEY_ID = 'id';

Solution 1:

You can use

SELECT*FROM cd ORDERBY datetime(substr(date, 7, 4) ||'-'|| substr(date, 4, 2) ||'-'|| substr(date, 1, 2))

Solution 2:

I created a new column with the existing KEY_DATE column and saved it in a yyyy-mm-ddd format. Then I updated my query to date("+KEY_FORMAT_DATE+")"; and it worked for me.

Solution 3:

Post a Comment for "Why Is The Order By Not Working In A Sqlite Query"