计算无小数的平均 [英] calculate an avg with no decimals

查看:69
本文介绍了计算无小数的平均的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我能弄清楚这一点.我需要生成一个平均值为AVG_AMT(整数)的表,并且没有小数.它可以舍入或截断.这张桌子真的没关系.

I wish I could figure this out. I need to produce a table with an average called AVG_AMT (integer) and has no decimals. It can either round or truncate. It really does not matter for this table.

这是我试图写的:

SELECT `TC Code`, AVG(ALW_AMT) as int(8,0) AS AVG_AMT
FROM OFFICE_Claims_Physicians
GROUP BY `TC Code`
ORDER BY `TC Code`;

有什么建议吗?

推荐答案

SELECT 
    `TC Code`, 
    round(AVG(ALW_AMT),0) AS AVG_AMT
FROM 
    OFFICE_Claims_Physicians
GROUP BY 
    `TC Code`
ORDER BY 
    `TC Code`;

这篇关于计算无小数的平均的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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