hope i am not misinterpreting your request
based on your post, some queries you could use:
select parentid, count(*) AS childcount FROM thattable GROUP BY parentid ASC;
also, you can do a left join to get ALL parent ids by joining the parent table:
select a.ID, COUNT(DISTINCT b.parentid) AS childcount FROM parenttable a LEFT JOIN thattable b ON a.ID=b.parentid GROUP BY a.ID;
the last query adds the ability to sort in a meaningful way:
select a.ID, COUNT(DISTINCT b.parentid) AS childcount FROM parenttable a LEFT JOIN thattable b ON a.ID=b.parentid GROUP BY a.ID ORDER BY a.lastname, a.firstname; [assuming those fields are present]
on the previous query, childcount is going to be zero if that parent id is not found in the child table, great for summaries of ALL parent items
P.S. Some more knowledgable sql guys might have something to say about that COUNT(DISTINCT b.parentid) as not the best way - I'm vaguely thinking there might be a better that that does work 🙂
Cheers,
Samuel