我有一个问题查询,可以同时从这些关系表中选择数据
SELECT posts.title, tags.tag
FROM posts_tags, categories_detail
INNER JOIN posts
ON posts.idpost = posts_tags.idpost, posts.idpost = categories_detail.idpost
INNER JOIN tags
ON tags.idtag = posts_tags.idtag
INNER JOIN categories
ON categories.idcategory = categories_detail.idcategory
我尝试过该查询,但它无效。这是错误
答案 0 :(得分:0)
您的错误是由于,
:
ON
造成的
ON posts.idpost = posts_tags.idpost, posts.idpost = categories_detail.idpost
您应该使用AND
代替。
ON posts.idpost = posts_tags.idpost AND posts.idpost = categories_detail.idpost