Reputation: 1625
I have database with row myDate | string
myDate is Date with format YYYY-MM-dd HH:mm:ss
. How to select newest date for example, I have:
2011-08-26 14:14:51
and
2011-09-21 12:25:45
And I need select statement to select last date (2011-09-21 12:25:45
). Please help me to write select statement..
Upvotes: 1
Views: 719
Reputation: 837926
Since the dates are stored similar to the ISO 8601 format, the lexicographical order corresponds to the chronological order. So you can just use MAX
:
SELECT MAX(myDate) FROM your_table
Upvotes: 4