comment

0

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science

Q&A for scientists using computers to solve scientific problems

-- 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 (6819,772035,1766831,492405,78845,1505939,13913,1108891,92315,995876,39933,3788176,1531124,6451573,23501,1755598,4249,54964,98117,207248,872395,334519,123109,569436,2598,5246885,7473,83805,89806,7586,251153,5260024,403671,31582,301832,464988,2756719,6277151,59303,548696,284795,40005,2501279,1743880,1695,64004,13552,91299,2435473,354577,1831293,412080,341251,1850609,51197,3146,740,562769,3702797,321697,16853,2173917,60711,390278,101258,364969,653856,1668533,121747,918959,56778,3522312,5866580,1202025,17624,1109,469935,302677,85134,18747,2766176,15809,1441122,1109017,21709,141555,15537,500104,157237,421223,91671,1412059,56541,205185,17174,104184,1012053,716216,669586,1426227)
   )
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 meta site
loading Hold tight while we fetch your results