Q&A for developers building blockchains with the Substrate SDK
-- 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 (1592191,515034,1520364,981744,5666987,774612,42124,8449629,477476,2930661,6782707,410289,1989480,875775,4390381,185647,496852,1551022,2491900,155336,1423922,3375906,11015427,1395668,1825618,1350476,367949,452587,13508,865874,2138,761202,4596,175071,1351469,352672,12388,3956070,3915438,1802671,3304426,4484822,38207,401656,1573712,2571840,450398,1870153,166452,11698,4385913,183422,1004046,423171,3203588,94144,1168804,299897,210818,1209430,940158,34598,1147273,246277,4608204,1609356,546205,6160119,563072,808091,250294,40256,266978,123204,9199828,1077364,1485885,4159572,27535,1119701,641955,880990,19082,155077,774116,99594,694576,2260,1765658,2658202,1509764,88558,390581,3933332,1400793,15622,182676,382763,4954037,220447) ) 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;