So I’m running MySQL version 5.1.4 and I’m trying to select distinct by a rounded value, and it works great except that it rounds numbers like 12.5 to 12 instead of 13. The columns I have tried this on have all been type double. I did a bit of research and saw the default behavior is to round half up so I’m wondering if there is some setting or parameter I need to change or if this is just broken?
Here is my query for reference :
SELECT DISTINCT ROUND(radius) as radius FROM arch WHERE radius != ” ORDER BY radius ASC
See this. Converting the
radiuscolumn toDECIMALshould solve the problem.