I have a data table which the primary key is formatted like M00001, M00002, M00003 ... so on. They are all string type. Is there any way to query the database to find the max primary key?
select max(id)
from t
If the RDBMS does not support max()
then:
select id
from t
order by id desc
limit 1
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