Open Community Wiki Questions with the most Answers and Favorites


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 P.Title, '' + CAST(P.Id AS nvarchar),
(SELECT Count(P.Id) AS PCount FROM Posts P WHERE P.ParentId = P.Id),
(SELECT Count(V.Id) AS VCount FROM Votes V WHERE V.PostId = P.Id AND V.VoteTypeId = 5),
(SELECT Count(C.Id) AS CCount FROM Comments C WHERE C.PostId = P.Id)
FROM Posts P, PostTypes Pt, Users U, Comments C, PostHistory Ph, Votes V, VoteTypes VT, PostHistoryTypes Pht
Pt.Id = P.PostTypeId
AND P.Id = C.PostId
AND U.Id = C.UserId
AND P.Id = V.PostId
AND P.Id = Ph.PostId
AND Vt.Id = V.VoteTypeId
AND Pht.Id = Ph.PostHistoryTypeId
AND Pt.Id = 1
AND Vt.Id = 5
AND C.Score > 0
AND Pht.Id = 16
AND P.ClosedDate is null
AND P.AcceptedAnswerId is not null
AND P.ParentId is null
AND P.Title is not null
AND P.LastEditDate is not null
AND P.LastActivityDate is not null

Enter Parameters

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