Separation between the sum of two columns

I need to take the sum of two columns and divide the totals. Both columns have a decimal data type. Here is what I still do not work.

SELECT total_salary / DistEnroll FROM dbo.vw_Salary WHERE DistEnroll = ( SELECT DISTINCT(distenroll) FROM dbo.vw_Salary WHERE YEAR = '2012' AND dist_name = 'Sch Dist' ) AND total_salary = ( SELECT SUM(total_salary) FROM [vw_salary] WHERE YEAR = '2012' AND dist_name = 'Sch Dist' ) 
+4
source share
1 answer
 select ( select sum(total_salary) from [vw_salary] where year = '2012' and dist_name = 'Sch Dist') --totalsal / (select count(distinct distenroll) from dbo.vw_Salary where year = '2012' and dist_name = 'Sch Dist') -- DistEnroll 

or better:

  select sum(total_salary) / count(distinct distenroll) from [vw_salary] where year = '2012' and dist_name = 'Sch Dist' 
+5
source

All Articles