Q&A about the site for people studying math at any level and professionals in related fields
SELECT TOP 15 pq.id, SUM(pq.Score) as score FROM ( SELECT p.Id as id, p.ParentId as parent_id, p.OwnerUserId as owner_user_id, p.Tags as tags, p.Score as score FROM posts p WHERE p.ParentId IS NULL UNION ALL SELECT pa.Id as id, pa.ParentId as parent_id, pa.OwnerUserId as owner_user_id, pq.Tags, pa.Score FROM posts as pa LEFT JOIN posts pq on pa.ParentId = pq.Id WHERE pa.ParentId IS NOT NULL ) as pq CROSS APPLY STRING_SPLIT(pq.Tags, '>') WHERE value <> '' GROUP BY pq.id, pq.parent_id, pq.owner_user_id, pq.tags, value ORDER BY id