DECLARE @TotalQuestions DECIMAL = ( SELECT COUNT(*) FROM ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Mathematics

Q&A for people studying math at any level and professionals in related fields

DECLARE @TotalQuestions DECIMAL = (
  SELECT COUNT(*) FROM Posts
);

DECLARE @UnansweredQuestions DECIMAL = (
  SELECT COUNT(*) FROM Posts WHERE AnswerCount = 0
);

-- The percentage of un-answered questions. Calculated
-- using this:
  -- (Unanswered Questions / Total Site Questions) * 100
SELECT 
  (@UnansweredQuestions / @TotalQuestions) * 100.0
AS [Percentage Of Unanswered Questions];

-- The percentage of answered questions. Calculated
-- using this:
  -- 100 - ((Unanswered Questions / Total Site Questions) * 100)
SELECT
  100 - ((@UnansweredQuestions / @TotalQuestions) * 100.0)
AS [Perentage Of Answered Questions];

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results