我有 3 个表格帖子、术语和关系。
帖子表:
ID title
1 abc
2 cdf
术语表:
term_id slug
1 jeans
2 shirts
关系表:
object_id taxonomy_id
1 1
2 1
我曾经尝试列出与“牛仔裤”相关的标题的 MySQL 查询
SELECT posts.title
FROM posts, terms, relationships
WHERE (SELECT terms.term_id FROM terms WHERE terms.slug LIKE '%jeans%')
AND (SELECT relationships.object_id FROM relationships WHERE terms.term_id = relationships.taxonomy_id)
AND (posts.ID = relationships.object_id)
它给了我错误 #1242 - 子查询返回超过 1 行。我怎样才能解决这个问题?