How to get max or last row id (string type) form any database table SQL

Rojan Dhimal
Oct 21, 2020

In this article, I will show you I sort and get the last id or max id of type string in the database table.

SELECT ID FROM Table_name order by cast(ID as int) desc limit 1

This will return the last id of the table.

--

--