如何四舍五入BigQuery [英] How to round in bigquery

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

问题描述

您如何在Google BigQuery中将0.2356舍入为0.23?

How do you round 0.2356 to 0.23 in Google BigQuery?

推荐答案

请记住, ROUND 返回 float ,因此它有两个参数,在第二个参数中,您可以定义要返回的小数.其他 CEIL FLOOR 返回 integer ,因此没有第二个参数,但是您可以使用数学模拟小数.

Remember that ROUND returns float, hence it has two parameters and in the 2nd parameter you are able to define the decimals you want returned. Others CEIL, FLOOR return integer, hence no second parameter, but you can mimic the decimals by using math.

select floor(0.2356*100)/100

Google BigQuery文档->函数和运算符->数学函数->回合

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

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