SELECT AttractedAttention, Count(Id) FROM ( SELECT Questi...

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
  AttractedAttention,
  Count(Id)
FROM (
  SELECT
    Question.Id,
    CASE
      WHEN COUNT( Answer.Id ) > 0 THEN 'Yes'
      ELSE 'No'
    END AS AttractedAttention
  FROM
    PostHistory AS Hist
  LEFT JOIN
    Posts AS Question
  ON
    Question.Id = Hist.PostId
  LEFT JOIN
    Posts AS Answer
  ON
    Answer.ParentId = Question.Id
    AND Answer.Score <> 0
  WHERE
    Hist.CreationDate >= '2021-01-01'
    AND Hist.PostHistoryTypeId = 50
  GROUP BY
    Question.Id
) AS T
GROUP BY AttractedAttention

Enter Parameters

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