vedi cosa c'è dentro alla tua tabella

SELECT stato, COUNT(stato) FROM messaggi GROUP BY stato