Q&A about the site for people who like playing board games, designing board games or modifying the rules of existing board games
WITH PostTagCombinations AS ( SELECT pt.PostId, STRING_AGG(t.TagName, ',') WITHIN GROUP (ORDER BY t.TagName) AS TagCombination FROM PostTags pt, Tags t WHERE pt.TagId = t.Id GROUP BY pt.PostId ), CombinationCounts AS ( SELECT TagCombination, COUNT(*) AS CombinationCount FROM PostTagCombinations GROUP BY TagCombination ) SELECT TOP 5 TagCombination FROM CombinationCounts ORDER BY CombinationCount DESC;