opster's elasticsearch-query tag answers with upvotes

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow на русском Meta

Вопросы и ответы о сайте для программистов

DECLARE @UserID int = ##UserID:int##;
SELECT DISTINCT
       Q.Title,
       SUM(V.Upvotes) OVER (PARTITION BY Q.Id) AS UpVotesInTag,
       CONCAT('https://stackoverflow.com/questions/',Q.ID,'/') AS URL
FROM dbo.Posts Q
     JOIN dbo.Posts A ON Q.Id = A.ParentID
     JOIN PostTags PT ON Q.Id = PT.PostId
     JOIN Tags T ON T.Id = PT.TagId
     CROSS APPLY (SELECT COUNT(*) AS UpVotes
                  FROM dbo.Votes V
                  WHERE V.PostId = A.Id
                    AND V.VoteTypeId = 2) V
WHERE A.OwnerUserID = @UserID AND
T.TagName='elasticsearch-query';

Enter Parameters

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