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 (29995,2756547,14357,305644,5728991,12993861,419,123471,852828,1987883,9493,33686,19299,1663001,168657,23649,2767755,267887,165495,3943312,100754,481267,797,1418796,149482,597657,459897,2296458,4465,18180,15541,9410,53212,565635,63756,45433,259769,179850,64313,27423,184046,878126,5623035,44853,89266,38206,59501,1463116,11123,885318,265143,511529,572,1841839,493,350087,81179,17744,60188,1744834,710446,1384297,1942,1734130,478399,1385941,344949,997358,1450,3037257,594420,105224,1950,1714410,97828,3848,320726,12579,3418066,288671,41021,477037,736079,198633,541038,167735,2988730,412770,2119,7582247,400547,1420197,451475,3191,121493,2586922,3617886,35092,9360,3593996)
   )
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