I want to select total comments posted on post. Somehow I am able to do it but the problem is that the total comment will show under each post even if there is no comment on the post.
Problem: Not able to get the comment related to post.
What I want :
To select total comment related to each post.
What I try :
SELECT SUM(total_comment) AS comment
FROM user_comment
INNER JOIN post
ON user_comment.image_id = post.id
WHERE status = 0
SELECT SUM(total_comment) AS comment
FROM user_comment
WHERE status = 0
Both the queries return all (total) comment on all posts but I want only show comment related to specific post.
yes, that’s the reason i post all of my index.php code where i am doing all the things…
I just want to show number of comments under each post. but the result are not what i want some time it returns comment 3 under each post even there is no comment on the post.