Facebook对每篇文章发表评论

时间:2013-04-19 14:09:48

标签: java php android mysql sql

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

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

1 个答案:

答案 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 ;