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 (25646,415448,5424988,980833,128983,76337,524368,785065,17172,348785,762073,329769,128421,438992,135978,811,4952130,62082,1155209,93623,1708801,14069,501696,39321,171318,1542290,567292,993547,120955,65696,2688,905,89771,1630618,71522,364696,649665,159145,1120273,6361531,445131,1600898,101361,1709587,1025118,84201,2410359,223386,5393381,4851590,266143,2313887,1695960,4238408,577088,305,41116,141172,601179,615754,1870803,1333873,383861,1140579,96656,244297,4766,3545273,1298762,97101,4725,9473764,44389,135531,561731,32632,741747,146325,13508,140740,1119701,345031,1249581,464581,903061,5441,152602,201952,67,851273,85785,4593267,95382,546661,1209279,90848,9097906,1832058,2231815,165737)
   )
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