sqlsqliteandroid-sqlitesql-order-by

SQLite Order By Date1530019888000


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?


Solution

  • you can do it like this

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