greatest() function in mysql returns blob -


i trying use greatest function of mysql if trying add 1 column sub queries returning me blob value , tried using mysql workbench, tried phpmyadmin results same.

below sql query :

select greatest(pm10index,pm2index,noindex,so2index,o3index,nh3index,coindex) table ; 

here values fetched sub queries.

the issue occurs when add pm10index column in function , if particular column pm10index removed function returns highest value correctly .

below value pm10index

pm10,        (case         when pm10 = 0   0        when pm10 <=50  pm10        when pm10 >50  ,   pm10 <=100 pm10         when pm10 >100 ,   pm10 <=250 100+(pm10-100)*0.666        when pm10 >250 ,   pm10 <=350 200+(pm10-250)        when pm10 >350 ,   pm10 <=430 300+(pm10-350)*1.25        when pm10 >430  400+(pm10-430)*1.25        end) pm10index 

pm10 defined varchar datatype , while other fields defined varchar

it great if can me here . in advance .

below value pm10index ... pm10 defined varchar datatype

there no varchar (or type of string) in code provided. if did cast data varchar, going end odd results (try select greatest('2','100');).

while mysql best compare strings , numbers, sooner or later going break. unless have @ least consistent data types (and should correct data types) code cannot relied upon.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -