SQLite Order By Date1530019888000

duncanportelli picture duncanportelli · Dec 30, 2012 · Viewed 82.7k times · Source

Every record in my SQLite database contains a field which contains a Date stored as a string in the format 'yyyy-MM-dd HH:mm:ss'.

Is it possible to query the database to get the record which contains the most recent date please?

Answer

Paritosh picture Paritosh · Dec 30, 2012

you can do it like this

SELECT * FROM Table ORDER BY date(dateColumn) DESC Limit 1