Created
October 26, 2023 18:29
-
-
Save anaibol/f692a20d13e9bd85fec91ea34344a4b2 to your computer and use it in GitHub Desktop.
Get products per keyword count
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 k.name AS keyword, COUNT(kp."B") AS count | |
FROM "Keyword" k | |
LEFT JOIN ( | |
SELECT DISTINCT "A" AS keywordId, "B" | |
FROM "_KeywordToProduct" -- Replace with the actual name of your intermediary table | |
) AS kp ON k.id = kp.keywordId | |
GROUP BY k.name | |
ORDER BY count DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment