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 (22656,6309,1144035,100297,157882,157247,23354,29407,115145,893,19068,17034,34397,95810,2901002,61974,5445,218196,19563,548225,1491895,23283,13302,15168,335858,106224,139985,69083,571407,88656,53114,217408,939860,13249,3832970,18393,505088,104349,279627,203907,209103,65863,65358,20860,9021,1968,1187415,18936,57695,12950,1126841,148870,224671,476,1863229,34509,367273,1583,119963,31671,179910,16417,1256452,596781,771848,67579,922184,223092,95592,284240,227665,263693,73226,187606,50079,1271826,479863,27535,45375,155423,55159,256196,276052,3043,1705598,182668,4279,28804,440558,1288,21234,138475,104891,4909087,28169,9530,1221571,541136,10661,85371)
   )
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