Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Divide 2 column in SQL

Author  Topic 

nikoo56
Starting Member

26 Posts

Posted - 2012-02-02 : 18:57:38
I would like to Divide 2 column in SQL and shows result as a third column.

1st column:

1.0*(select count(*) from tblC5ProspectCalls pc (nolock) where pc.prospect_id = p.prospect_id and pc.call_result_id between 1 and 3) call_attempts,

2nd column:

1.0*(select count(*) from tblC5ProspectCalls pc (nolock) where pc.prospect_id = p.prospect_id and pc.call_result_id = 3) tt,

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-02 : 19:39:44
[code]
(select 1.0* count(case when pc.call_result_id between 1 and 3 then 1 end)/count(case when pc.call_result_id = 3 then 1 end) as thirdcolumn from tblC5ProspectCalls pc (nolock) where pc.prospect_id = p.prospect_id) ,...
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -