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 (446279,167897,559745,5025009,448580,157397,971,349909,49241,2612235,366256,150967,95353,19435,321973,2796,94363,446822,492513,3077495,6260,532430,575765,2302862,479251,1122645,1987598,2497492,357124,169165,7404323,1936853,5366046,1309708,635364,536078,8581025,2689257,2050087,205589,3393718,727028,7899301,828952,929740,5759942,3480122,3265872,122423,1290203,93623,1109,3617886,282848,544825,318425,694331,1851712,725418,58961,109374,38055,2030321,1524450,56763,346804,842,198128,73772,1137669,1296280,5576310,45685,598511,576719,7241,646887,1696560,44620,6699433,1933675,66849,64495,1163019,57068,227803,210964,296568,87973,4510,6345,3074768,247563,2389707,592253,929999,79354,2114,1035889,44563) ) 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;