SELECT a.id, a.nome,
(SELECT COUNT(c.id) FROM postagens as c WHERE c.data_cadastro >
b.data_acesso AND c.id_categoria = a.id AND deletado = 0) as atualizacoes
FROM postagens_categorias as a
LEFT JOIN postagens_categorias_view as b ON a.id = b.id_categoria
WHERE a.deletado =0 AND a.id != 3 ORDER BY a.nome DESC
And give this result here:
ThedataI'dlikewouldbe:
Projetos25Estágios24Divulgação21
IthinkIshoulduseaGROUPBYsomewhere,ifIuseDISTINCTinthebeginningitwillstillduplicatevaluesonlyinplaceofNULL,0.
Hereisthepoststable_categories:
Postings_categories_view:
Posts:
How do I do this part?