comment

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

-- Step 3: Extract comments for the posts in batches
WITH CommentBatch AS (
    SELECT 
        c.Id AS CommentId, 
        c.Text, 
        p.Title, 
        p.OwnerUserId AS UserId, 
        u.DisplayName,
        u.Location,
        t.TagName,
        ROW_NUMBER() OVER (PARTITION BY p.Id ORDER BY c.CreationDate DESC) AS CommentRowNum
    FROM Comments c
    INNER JOIN Posts p ON c.PostId = p.Id
    INNER JOIN Users u ON p.OwnerUserId = u.Id
    INNER JOIN PostTags pt ON p.Id = pt.PostId
    INNER JOIN Tags t ON pt.TagId = t.Id
    WHERE t.TagName IN ('python', 'java', 'csharp', 'php', 'javascript', 'go', 'swift') -- Programming languages filter
    AND p.OwnerUserId IN (613130,21677,234938,25050,318758,109305,880990,1180620,2670892,290085,613198,1384652,12983,149080,184883,256970,150634,21632,13792,714968,189205,1000343,370305,18511,108205,2411802,4105,32880,106159,273200,241631,25324,25222,67392,304,282848,861716,445517,135786,210578,428790,16363,107744,846273,466862,29,205608,15245,2140,44084,573261,238886,387076,95612,74757,1422451,314291,1104384,41360,98607,25449,348545,214010,2483313,91914,128511,82320,1229023,188246,8815,2455888,13055,142434,179125,410767,2442099,776560,7595,75642,411591,1686485,191596,80860,130758,3250829,75500,5423108,1285133,24054,5185595,6461,104458,377270,17279,16632,45664,15861,1811992,12725,4482)
   )
SELECT 
    cb.CommentId,  
    cb.Title AS CommentTitle,
    cb.Text AS CommentText,
    cb.UserId, 
    cb.DisplayName AS UserName,
    cb.Location AS UserCountry,
    cb.TagName AS CommentTag
FROM CommentBatch cb
WHERE cb.CommentRowNum BETWEEN 1 AND 500;

Enter Parameters

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