Count of questions/answers as the first post

1

Please login or register to vote for this query.

(click on this box to dismiss)

Cognitive Sciences Meta

Q&A about the site for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry

; with firstposts_cte AS (
SELECT
  u.Id AS uid,
  MIN(p.Id) As minid
FROM Users u INNER JOIN Posts p ON p.OwnerUserId=u.Id
GROUP BY u.Id
)

SELECT 
  SUM(Case When p.PostTypeId=1 Then 1 Else 0 End) AS [Questions],
  SUM(Case When p.PostTypeId=2 Then 1 Else 0 End) AS [Answers],
  COUNT (p.ClosedDate) AS [Closed Questions]
FROM firstposts_cte f INNER JOIN Posts p ON f.minid=p.Id

Enter Parameters

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