Highest voted comment vs. answer score 2D histogram

0

Please login or register to vote for this query.

(click on this box to dismiss)

Audio-Video Production Meta

Q&A about the site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation

-- ##N:int?30##
-- 'MOD' is not a recognized built-in function name.

SELECT sel.Idx - (sel.Idx / ##N##) * ##N## as [Answer Score], sel.Idx / ##N## as [Comment Score], Count(sel.Idx) as [Occurence]
FROM 
(SELECT sel.AScore * ##N## + sel.CScore as [Idx]
FROM
(SELECT IIF(a.Score < ##N##, a.Score, ##N##) as [AScore], IIF(c.Score < ##N##, c.Score, ##N##) as [CScore]
FROM Posts a
INNER JOIN
( SELECT c.PostId, MAX(c.Score) as [Score] -- PostId and highest voted comment score
  FROM Comments c
  WHERE c.Score > 0
  GROUP BY c.PostId) c
ON a.Id = c.PostId
WHERE a.PostTypeId = 2 -- answers
AND a.Score >= 0) sel) sel
GROUP BY sel.Idx
ORDER BY sel.Idx

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results