[英]How to round results to nearest whole number - SQL
From my query below, I need to have the results listed to the nearest whole number, using the ROUND
function. 从下面的查询中,我需要使用
ROUND
函数将结果列出到最接近的整数。
Select dogs_id, Name,
POWER(money,2)/2 AS 'New Prize Money'
FROM DOG_EVENT
That runs fine, but one of the results comes up as 14.5, and I need that rounded to the nearest whole number. 可以正常运行,但结果之一为14.5,我需要将其四舍五入为最接近的整数。
Where and how can I add that to my query above, so that it rounds off to the nearest whole number? 我可以在哪里以及如何将其添加到上面的查询中,以便四舍五入到最接近的整数?
我猜这是被2除的部分
Select dogs_id, Name, ROUND(POWER(money,2)/2, 0) AS 'New Prize Money' FROM DOG_EVENT
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.