Skip to content
Advertisement

How to fetch the last row in MySQL in THIS scenario?

I have the table – checkdate

The Structure is …

( 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…

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

Advertisement

Answer

Assuming the data type of curr_date is string. Following query will work for you.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement