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 (465183,721269,3333,978917,165673,546730,1057,14637,67606,91,102937,477878,2141635,1902010,11654,602276,15416,497418,58808,5380,4342498,572670,1707091,1204143,1695906,314488,19750,295783,271616,813,500584,123527,3923281,40347,235698,246342,836330,871050,309308,3297613,429846,790387,572644,1240763,1338292,324364,712649,5221944,3309790,1501794,264697,813602,1175966,87698,126214,113570,39430,122718,137350,1782465,12500315,247243,6509,981959,19679,9204,50476,817643,745,99834,419970,48015,418556,42346,352765,8747,247533,314166,501250,51685,462627,252228,144424,4668,790695,35364,221700,338665,24545,55075,783119,283366,478884,9209546,13627,362536,942852,14660,33732,220819) ) 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;