I have tried to fetch records from 2 tables but it is not showing required output where my first table is ttreply
And another table is ttreplycount where count stored as below:
I have tried to fetch value but it doesn't fetch records as i want my mysql query as below:
SELECT r.id, r.userid, r.`reply`, coalesce(x.votes,0) as Votes
FROM `ttreply` r left join
(SELECT sum(votes) as Votes from `ttreplyvotes` )x ON r.`post_id`=2
Which showing me output like this:
What i needed is like this:
id userid reply Votes
2 3 Testing 2nd reply -2
3 3 Testing 3nd reply 0
4 3 rewsf 0
Any help would be helpful.


