I have the following tables in MySQL (it is more complex than the example, I simplified it):
CURSO: id | nome
CURTIDA: id | id_curso
Every time someone takes a course, they feed the CURTIDA table
Now, when I'm going to SELECT the course, I'd have to get the amount of tanned, I did this:
SELECT *, count(curtida.id) AS curtidas FROM curso
LEFT JOIN curtida ON curtida.id_curso = curso.id
But I'm not getting the right number of tanned ... and if the course has not tanned, nor appearing is in this select.