╔═════════════╦════════════╗
║ posts ║ categories ║
╠═════════════╬════════════╣
║ id ║ id ║
║ title ║ name ║
║ slug ║ slug ║
║ content ║ ║
║ category_id ║ ║
╚═════════════╩════════════╝
给定slug
一个类别,我想选择该类别中的所有帖子。这些帖子与category_id
-> id
of category 链接。
SELECT `posts.title`
FROM `categories`
INNER JOIN `posts`
ON `posts`.`division` = "1"
WHERE `category_slug` = "$category_slug"
它给了我一个Unknown column 'posts.title' in 'field list'
虽然。给定类别的 slug,我如何选择所有帖子?