SELECT A.BBB/A.CCC FROM ( SELECT (SELECT Count(NUM1.Id) A...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT A.BBB/A.CCC
FROM
(
SELECT 
    (SELECT Count(NUM1.Id) AS ABE
      FROM (SELECT P.Id
            FROM POSTS P
            WHERE P.PostTypeId = 1
            AND P.AcceptedAnswerId IS NOT NULL
            AND P.AnswerCount >= 2) AS NUM1) BBB,
            
    (SELECT COUNT(NUM2.Id) AS fffB
      FROM 
      (SELECT p1.Id
      FROM POSTS p1  
      INNER JOIN POSTS acc on acc.Id = p1.AcceptedAnswerId
      INNER JOIN POSTS ans on ans.ParentId = p1.Id and ans.PostTypeId = 2 and ans.Id != acc.Id
      WHERE p1.PostTypeId = 1
      GROUP BY p1.Id, p1.Title, acc.Score
      HAVING MAX(ans.Score) > acc.Score) NUM2) CCC
) A

Enter Parameters

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