Q&A about the site for enthusiasts and scholars of mythology and folklore
-- 5. Find 10 most popular two tag combinations, which have been used in posts. SELECT TOP 10 Tags.TagName, Tags2.TagName, COUNT(p.Id) AS NumberOfPosts FROM Tags CROSS JOIN Tags AS Tags2 INNER JOIN (SELECT TOP 1000 * FROM Posts) AS p ON p.Tags LIKE '%<' + Tags.TagName + '>%' AND p.Tags LIKE '%<' + Tags2.TagName + '>%' WHERE Tags.TagName <> Tags2.TagName GROUP BY Tags.TagName, Tags2.TagName ORDER BY NumberOfPosts DESC