Post and Abandon Count

0

Please login or register to vote for this query.

(click on this box to dismiss)

Quantum Computing Meta

Q&A about the site for engineers, scientists, programmers, and computing professionals interested in quantum computing

SELECT COUNT(*) AS AbandonedPosts
       /*
       P.Id,
       CONCAT(N'https://stackoverflow.com/questions/',P.Id) AS PostLink
       */
FROM dbo.Posts P
WHERE NOT EXISTS (SELECT 1
                  FROM dbo.PostHistory PH 
                  WHERE P.Id = PH.PostId
                    AND PH.PostHistoryTypeId = 5
                    AND PH.UserId = P.OwnerUserId)
  AND NOT EXISTS (SELECT 1
                  FROM dbo.Comments C
                  WHERE C.PostId = P.Id
                    AND C.UserId = P.OwnerUserId)
  AND NOT EXISTS (SELECT 1
                  FROM dbo.Posts A
                  WHERE A.ParentId = P.Id)
  AND P.PostTypeID = 1
  AND P.CreationDate >= '20240101'
  AND P.CreationDate < DATEADD(HOUR, -3, SYSUTCDATETIME())
--ORDER BY P.Id;

Enter Parameters

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