SQL:没有小数位的返回百分比

时间:2009-09-08 18:42:20

标签: mysql

快速提问;有没有办法在select语句中应用数字类型?

exmaple usage

select (t1.f_count / (select count(*) from utb where user_id = 1))*100 as ratio

我需要这个来返回60而不是60.0000

1 个答案:

答案 0 :(得分:3)

select ROUND((t1.f_count / (select count(*) from utb where user_id = 1))*100) as ratio