当我应用此查询时,它会反复显示每个帖子的评论:
"SELECT post.posttext,post.post_id,comment.comt_id
FROM post FULL JOIN comment ON post.post_id=comment.post_id
AND user.user_id=".$userid."" ;
答案 0 :(得分:1)
试试这个:
SELECT post.posttext, post.post_id, comment.comt_id
FROM post
LEFT JOIN comment ON
post.post_id=comment.post_id AND user.user_id={$userid}
GROUP BY comment.comment_id ;