Q&A about the site for teachers and students of the Esperanto language
-- 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 (180136,7510657,946312,2024761,533399,1083093,1719067,1577396,1041642,1817690,468724,85597,953140,40933,4999394,1448,32688,236128,3374996,8987128,2815635,8708524,2455259,575376,89391,11654,813602,122718,252228,1531124,15809,1412059,3081018,9410,95612,296328,457406,359307,637853,837534,113195,2991525,66686,941764,1307905,1741542,23368,1082681,520162,947357,45773,201863,995891,455493,1333025,1816580,1178669,1392379,77507,1163423,480982,3219613,1643939,117362,3744304,1221571,1348195,11236,5157454,572670,871050,817643,942852,601179,1870803,464988,104380,1084,9833,74314,703717,878126,478399,1714410,3848,9611,1631379,11208,139300,573,447356,5037551,140937,7882470,1057429,25645,1625737,293929,448296,6336479) ) 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 0 AND 500;