I have the table - checkdate
The Structure is ...
Curr_date
150120
160120
170120
180120
( Date format is DDMMYY )
Only Single column is there which is the 'Primary Key'
Now I want to fetch the LATEST DATE or CURRENT DATE saved in the table ( Which will not always be the last row )
Example: The Date latest added date is : 010122
Then, the record will show like...
Curr_date
010122 <--- The Latest date is on the top
150120
160120
170120
Now how to fetch the Last Added Row in MySQL ? In this Scenario ?
( Note : select TOP 1 * from table_name order by Id desc
, doesn't work... And also I want to work without ID column... )
EDITED : The Datatype is String
Assuming the data type of curr_date is string. Following query will work for you.
select curr_date
, STR_TO_DATE(curr_date,'%d%m%Y')
from test
order by STR_TO_DATE(curr_date,'%d%m%Y') desc;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With