╔═════════════╦════════════╗
║    posts    ║ categories ║
╠═════════════╬════════════╣
║ id          ║ id         ║
║ title       ║ name       ║
║ slug        ║ slug       ║
║ content     ║            ║
║ category_id ║            ║
╚═════════════╩════════════╝


给定类别的slug,我想从该类别中选择所有帖子。这些帖子与类别的category_id-> id链接。

SELECT `posts.title`
FROM `categories`
INNER JOIN `posts`
ON `posts`.`division` = "1"
WHERE `category_slug` = "$category_slug"


它给了我一个Unknown column 'posts.title' in 'field list'。给定类别的标签,如何选择所有帖子?

最佳答案

看起来像你想要的

SELECT `posts`.`title`


代替

SELECT `posts.title`

关于mysql - 选择帖子内部联接类别,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11770256/

10-14 18:53