MAX/MIN giving me wrong values in mysql

后端 未结 1 1509
挽巷
挽巷 2021-01-26 20:36

I am trying to get the MAX() or the MIN() value of a dataset.

Sample data:

equipment_id, value, updateTimestamp

7         


        
1条回答
  •  孤城傲影
    2021-01-26 21:01

    The value appears to be stored as a string, rather than as a number. Try this instead:

    SELECT dv.equipment_id, ROUND(MIN(cast(dv.value as decimal(5, 2))), 2) as value 
    

    0 讨论(0)
提交回复
热议问题