Max date limit for sql by 1
Instead of using a timestamp, I use this one date('Y-m-d h:i:s A')
and store it as a string. My problem is that I cannot get the last value of the date inserted because I am using:
SELECT id, date FROM table Date ORDER_BY DESC limit 1
The output 2015-05-28 09:11:16 PM
is id = 10
fetched which is , but what I am trying to extract is this id = 12
. Is there a way to compare these values and select the last one: id 12?
The table is ordered by date desc
| id | date |
================================
| 12 | 2015-05-28 09:26:20 PM |
| 11 | 2015-05-28 09:26:04 PM |
| 10 | 2015-05-28 09:11:16 PM |
+3
source to share