[英]rounding to nearest percentage
If I have a formula such as如果我有一个公式,例如
count(s.listing_id) / count(a.listing_id) * 100
and I want to round to the nearest whole percentage,我想四舍五入到最接近的整数百分比,
would ROUND(count(s.listing_id) / count(a.listing_id) * 100),1) work?
as in if the value is .03881 should be 39?如果值是 .03881 应该是 39?
ROUND( count(s.listing_id) / count(a.listing_id) * 100 )
rounds to a whole number. ROUND( count(s.listing_id) / count(a.listing_id) * 100 )
入为整数。
ref: the manual参考: 手册
Try adding more brackets.尝试添加更多括号。 Your formula still technically works in the way of PEDMAS, but this will future proof it.你的公式在技术上仍然以 PEDMAS 的方式工作,但这将在未来证明它。
ROUND(((count(s.listing_id) / count(a.listing_id)) * 100)),0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.