Say there are two tables:
TABLE A
messageID / Message / More.. 1 / This is the first message / Etc.. 2
Try this query:
SELECT a.*, b.msgCount FROM tableA a LEFT JOIN ( SELECT messageID, COUNT(1) AS msgCount FROM tableB b GROUP BY messageID) b ON a.messageID = b.messageID