2009-09-08 108 views
1

快速提問;有沒有辦法在select語句上應用數字類型?SQL:無小數點返回百分比

〔實施例使用

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

我需要這個來回報60,而不是60.0000

回答

3

嘗試

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

缺少 '(' 輪 – Joshua 2009-09-08 18:57:31

+0

確實後,現在固定:) – Pomyk 2009-09-08 19:05:01

+0

謝謝非常 – ryan 2009-09-08 19:16:58