Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

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
 
PREVIOUS NEXT
Tagged: #mysql #max #number #returning #correct
ADD COMMENT
Topic
Name
7+2 =