Query is not red and blue works!
SELECT * FROM posts LEFT JOIN (SELECT COUNT(id_rela_post), ifnull(qt_vezes, 0), para FROM rela_post GROUP BY para) post_detalhe on posts.id_post = post_detalhe.para
The correct thing would be to put IFNULL(COUNT(id_rela_post), 0)
, instead of putting it in the search alias.