我希望我能弄清楚这一点。我需要生成一个平均称为AVG_AMT(整数)的表,并且没有小数。它可以是圆形或截断的。这桌子真的没关系。
这是我试过写的:
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`;
有什么建议吗?
答案 0 :(得分:4)
SELECT
`TC Code`,
round(AVG(ALW_AMT),0) AS AVG_AMT
FROM
OFFICE_Claims_Physicians
GROUP BY
`TC Code`
ORDER BY
`TC Code`;
答案 1 :(得分:1)
您想使用ROUND()功能
SELECT `TC Code`, ROUND(AVG(ALW_AMT)) as int(8,0) AS AVG_AMT
FROM OFFICE_Claims_Physicians
GROUP BY `TC Code`
ORDER BY `TC Code`;
答案 2 :(得分:0)
使用Round函数
SELECT `TC Code`, ROUND(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),1/2) as int(8,0) AS AVG_AMT
FROM OFFICE_Claims_Physicians
GROUP BY `TC Code`
ORDER BY `TC Code`;