有这三个表:MySQL的:简单的查询修改
- 帖子
- posts_replies
- 喜欢
该查询返回我的帖子及其回复数无一不精。
SELECT posts.title, posts.num, posts.status, posts.category, posts.content, posts.member_num, COUNT(posts_replies.blyrb_num) AS count, COUNT(likes.comment_num) AS likes_count
FROM posts_replies
INNER JOIN posts ON (posts_replies.blyrb_num = posts.num)
LEFT JOIN likes ON (likes.comment_num = posts_replies.num)
WHERE posts.status <>3
AND posts.access = 'Public'
AND (
posts.title LIKE '%dress%'
OR posts.content LIKE '%dress%'
)
GROUP BY posts.num
但问题是这个查询只返回有一些答复的帖子。我不想要这样的限制,我想要所有帖子,不管他们是否有答复。
任何想法,我在做什么错在这里?
谢谢
您的岩石!谢谢你的男人:D – 2013-03-03 08:58:28