I can not make left join and use GROUP BY

0

This is a system for selecting how many likes you have in each post!

in the third image shows the relation of likes. of = user id and for the post id

First image shows the result of how many likes each post has, but I also need to show posts that have 0 likes.

For my knowledge I should change inner join to left so it would prioritize the left, and show the posts that have likes and the ones that do not, but if I do, it does not show what I expected! >

How to solve this?

SELECT COUNT (*) as qt, posts.id_post FROM posts INNER JOIN rela_post ON posts.id_post = rela_post.to GROUP BY rela_post.to

    
asked by anonymous 10.02.2018 / 16:05

0 answers