-4

当我应用此查询时,它会反复显示每个帖子的评论:

"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."" ;  
4

1 回答 1

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 ;
于 2013-04-19T14:18:20.930 回答