I have 3 tables: articles, tags and article_tag (the one which connects them).
I’d like to find all articles that have some (or all) of the tags listed in the query and order them by the number of matched tags. Is it possible?
Example in english:
Query: Find me all articles that have at least one of these tags "jazz, bass guitar, soul, funk", order them by the number of matched tags.
Output:
Article 1 (jazz, bass-guitar, soul, funk)
Article 2 (jazz, bass-guitar, soul)
Article 3 (jazz, bass-guitar)
Article 4 (funk)
Probably something like this: