Answers for "mysql max number not returning correct value"

SQL
0

mysql max number not returning correct value

//This happen due to your comlum donot have interger data type so to relove this
issue there are two ways the first one is change the DATA TYPE to interger

or

another method is to 

SELECT values  FROM  `students` where   id='96' order by cast(values as SIGNED) desc limit 1;

the  cast(values as SIGNED)  will convert the str value into integer value then it will works fine
======CAst example======

https://www.tutorialspoint.com/how-to-get-the-maximum-value-from-strings-with-integers-in-mysql
Posted by: Guest on February-10-2022

Code answers related to "SQL"

Browse Popular Code Answers by Language