sql - 如何在sql中将多个数字列四舍五入为2位?
问题描述
假设我现在需要将多个数字四舍五入为 2 位数字,但我不想重复使用round(..., 2)
or format(...)
。
有什么方法可以全局设置 2 位浮点数吗?
解决方案
select cast(float_column as decimal(10,2))
from your_table
推荐阅读
- javascript - Vue:.vue 模板中无法识别 pug 语言
- python-3.x - 我如何在我的 bot.py 中制作顶级服务器?
- sql - 我可以结合 like 和 equal 来获取数据吗?
- javascript - 事件侦听器未附加?
- php - Laravel 工厂状态 - 无法找到工厂
- excel - 使用命名范围字母作为起点
- r - 区分 ggplot2 热图中组之间的分面
- c# - 使用 new 和 gcnew 创建公共 ref 类的对象
- swift - 我试图只允许 SKSpritenode 跳转一次但速度有问题
- amazon-web-services - Cloudfront 最小 TTL 有什么用?