0

我有一个表,其中包含两种类型的信息,一种称为Number_Of_Calls,另一种称为Number_Of_Answered

现在在我的应用程序中,我想获得百分比的百分比,Number_of_answered并且Number_of_calls我认为在数据库中计算将是最好的方法。

但是我不知道如何在 SQL 中计算

到目前为止,我有:

Select Number_Of_Calls,
       Number_of_answered 
  from table 
 Where Date BETWEEN '2012-09-10' AND '2012-09-11'
4

2 回答 2

6
select 
Number_of_Calls,
Number_of_Answered,
((Number_of_answered/Number_Of_Calls)*100) as answer_percent,
Date
from table Where Date BETWEEN '2012-09-10' AND '2012-09-11'
于 2012-12-05T15:03:34.020 回答
3
select 
Number_Of_Calls,
Number_of_answered
((Number_of_answered/Number_Of_Calls)*100.00) as percent
from table_name Where Date BETWEEN '2012-09-10' AND '2012-09-11'
于 2012-12-05T15:04:48.150 回答