I took over a database with two tables, lets name them
entries
comments
entries
comments
entries
entries
comments
entries
id
comment_count
comments
id
blogentry_id
entries
I think a pure SQL solution would invlolve using a subquery to gather the counts from the comments table having the entries table as the driver. Something like the following should "loop" over the entries table and for each row perform the subquery (that may be the incorrect terminology) and update the comment count to be that of the corresponding counts off of the auxillary table. Hope that helps!
UPDATE entries ent
SET comment_count =
(SELECT COUNT ( * )
FROM comments cmt
WHERE cmt.blogentry_id = ent.id)