我想用我的数据库中的一个查询加载所有帖子及其标签。
我认为 LEFT JOIN 是合适的,你有任何其他建议吗?
这是我的 SQL 查询:
SELECT * FROM posts, tags, tags_map
LEFT JOIN posts on posts.cid = tags_map.pid
WHERE tags.tag_id = tags_map.tid
它显示错误 Not unique table/alias: 'posts'
哪里错了,因为我指向一个名为 'posts' 的表,知道吗?
最佳答案
从“FROM”部分删除帖子表:
SELECT * FROM tags, tags_map
LEFT JOIN posts on posts.cid = tags_map.pid
WHERE tags.tag_id = tags_map.tid
关于mysql - 左连接 "Not unique table/alias",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30153067/