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 (134204,133802,1357341,1593077,10263,119280,1864976,4120,1317805,839646,379693,104380,105570,213269,1136211,80274,33006,1084,338204,622310,788207,7714,400617,214671,414076,250260,3574081,9833,957768,3207,24587,497356,52738,271959,1163867,4376,1831,62576,74314,703717,643383,3785314,3110834,89817,198707,189179,58803,131874,1053,424300,641955,263268,1393766,1009603,1196,84889,1679310,234,15031,1038015,2696260,398968,134554,2611,1098851,355230,2235132,2144390,58186,38360,2603,3081018,147601,299924,4851043,1009479,613430,1267329,1927832,4620771,1033896,3713,135566,5056,610569,123671,8954,1275169,3001761,134830,2035262,884978,745903,259038,280244,218589,1995738,1059372,143378,20394) ) 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;