count from two different tables possible?

is it possible to return the count of two different joins, e.g.

select name, count( num_posts, count( num_friendsfrom users inner join posts on posts.user_id = inner join friends on friends.user_id = users.idgroup by

when I try this, I get very large numbers for num_posts and num_friends, and the two numbers are identical. if I only try to select one of the counts, then i get the expected number.


you might try to doing the counts prior to doing the joins.

for instance:

select nameleft join ( select count(1), user_id from posts group by user_id ) p on = p.user_idleft join ( select count(1), user_id from friends group by user_id ) f on = f.user_idfrom users u

fantastic… looks like that does it. thanks!