【发布时间】:2010-02-10 22:45:31
【问题描述】:
我有 3 个表:articles、tags 和 article_tag(连接它们的那个)。
我想查找在查询中列出了部分(或全部)标签的所有文章,并按匹配标签的数量对它们进行排序。有可能吗?
英文示例:
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)
【问题讨论】: