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 (267,114251,3962914,216074,77567,7432,139459,276101,263525,895245,14343,1240268,149392,9515207,2988,3597276,2225682,143305,215945,908494,413501,171456,415784,118068,68587,139010,674039,2016562,26428,224132,151292,4883,73070,487339,34211,938089,992484,3153,16883,5459839,94197,222908,70393,605744,12711,6782,5190,18771,4124317,519413,20670,69755,51816,34088,829571,507674,96100,7964527,398670,46058,24181,2887218,187690,965051,298479,208809,807126,1259510,75170,2877241,24874,2422776,748858,113962,40342,5987,116,174728,405017,6521,16076,526535,97337,342852,147192,53013,464744,2711488,105929,2336654,14122,98713,35070,6068,1529630,5044042,47773,325565,103167,65387) ) 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;