Reputation: 2983
My SQLite database has a column called date
which is DATETIME
. I have used :
cur.execute("SELECT * FROM Posts ORDER BY date(date) DESC")
It orders oldest first but I want it the other way around.
Upvotes: 0
Views: 8048
Reputation: 33
select (substr(SDate,7,10) || '-' || substr(SDate,4,2) || '-' || substr(SDate,1,2)) as SDate2
order by SDate2 desc
Upvotes: -2
Reputation: 1
try not to use "date" word as a column name when creating a database table, because this name is reserved for the systems, try to change the name from date to another name, and try again.
Upvotes: 0
Reputation: 29804
I'll suggest you to try the inverse:
cur.execute("SELECT * FROM Posts ORDER BY date ASC")
and see if it works.
Hope this helps!
Upvotes: 3