修整MYSQL中的问题 [英] Rounding off problem in MYSQL

查看:80
本文介绍了修整MYSQL中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友
我在mysql中有问题,这是我的查询,我想要结果1

Hello friends
i have a problem in mysql this is my Query and i want the result 1

SELECT ROUND(0.50,0)


我怎么能做到这一点,我得到0


how can i achive this, iam getting 0

推荐答案


我相信该查询将始终返回零,这基于数学规则是正确的.当小数部分正好是.5时,它返回的整数是偶数.也就是说,0.50返回0,而1.50返回2.在您的情况下,为了使结果为1,则数字必须大于等于= 0.51.希望对您有所帮助.
Hi,
I believe that the query will always return zero and that is correct based on rule of mathematics. When the decimal part is exactly .5 it returns the whole number as even. That is, 0.50 returns 0 and 1.50 returns 2. In your case, in order for your result to be 1, then the number must be >= 0.51. I hope that helps.


这篇关于修整MYSQL中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆