如何在MySQL中四舍五入到最接近的整数? [英] How to round down to nearest integer in MySQL?

查看:175
本文介绍了如何在MySQL中四舍五入到最接近的整数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MySQL中四舍五入到最接近的整数?

How would I round down to the nearest integer in MySQL?

示例:12345.7344 rounds to 12345

mysql的round()函数四舍五入.

mysql's round() function rounds up.

我不知道值和小数位将是多长时间,可能是10位数字和4位小数,可能是2位数字和7位小数.

I don't know how long the values nor the decimal places will be, could be 10 digits with 4 decimal places, could be 2 digits with 7 decimal places.

推荐答案

使用地板:

SELECT FLOOR(your_field) FROM your_table

这篇关于如何在MySQL中四舍五入到最接近的整数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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