-
-
Save hailwood/17817d1fb1d144303358 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT SiteTree.`ID`, COUNT(KnowledgeBaseArticle.`ID`) AS TagMatches FROM KnowledgeBaseArticle | |
JOIN SiteTree ON KnowledgeBaseArticle.`ID` = SiteTree.`ID` | |
JOIN KnowledgeBaseArticle_Tags ON KnowledgeBaseArticle_Tags.`KnowledgeBaseArticleID` = KnowledgeBaseArticle.`ID` | |
JOIN KnowledgeBaseTag ON KnowledgeBaseArticle_Tags.`KnowledgeBaseTagID` = KnowledgeBaseTag.`ID` | |
WHERE KnowledgeBaseTag.`Title` IN ('apples', 'oranges') | |
GROUP BY KnowledgeBaseArticle.id | |
ORDER BY TagMatches DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment