将数字格式设置为2位小数 [英] Format number to 2 decimal places

查看:196
本文介绍了将数字格式设置为2位小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如: $ b $

$ p
$ b

  2229,999  - > 2229,99 

我已经试过了:

<$ (2229.999,2)
CONVERT(2229.999,DECIMAL(4,2))

谢谢

解决方案

要使用 TRUNCATE 命令。

http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_truncate


I would like to know how can I output a number with 2 decimal places, without rounding the original number.

For example:

2229,999 -> 2229,99

I already tried:

FORMAT(2229.999, 2)
CONVERT(2229.999, DECIMAL(4,2))

Thanks

解决方案

You want to use the TRUNCATE command.

http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_truncate

这篇关于将数字格式设置为2位小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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