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 (588867,617801,1465704,1950295,414184,6737970,2607177,168501,631612,424721,4515004,1866563,4766534,12219679,7811940,1748599,395169,4022390,1776916,551406,7585,474189,20126,139985,134633,9990,5380,2313887,797,53212,493,3418066,5768908,405143,1897,497043,221955,4161,195835,474349,913184,4014959,78000,5648954,10583,314661,390388,1258398,179630,58129,248521,63810,17041,4468648,2067753,5769,53158,1294207,19851,23341,23339,70157,138206,28832,611,36036,39532,13163,41211,49,3068190,124259,881441,3293881,1501794,84201,1202025,370305,567751,5726027,472375,1190388,1860929,1823841,661933,6433023,4248328,12833166,46297,2396539,111435,2522554,155861,1134940,174261,776084,1011959,1114338,4921103,3218114) ) 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;