Min and Max are inversed in MySQL -


i don't know why have when try min , max receive wrong response!

here content date :

enter image description here

and here mysql request :

select min(`value`),max(`value`) weather_data `date`="2015-10-22" , `type`="temperature" 

but response of mysql request : http://puu.sh/ktr1q/af165a2dd9.png

do have idea of why have response?

it looks value represented string. so, happily, min() , max() working correctly.

if values can converted on system, can use:

select min(`value` + 0), max(`value` + 0) weather_data `date` = '2015-10-22' , `type` = 'temperature'; 

the + silent conversion. if min , max both return 0, commas not recognized, replace them periods:

select min(replace(`value`, ',', '.') + 0), max(replace(`value`, ',', '.') + 0) weather_data `date` = '2015-10-22' , `type` = 'temperature'; 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -