List:General Discussion« Previous MessageNext Message »
From:John Meyer Date:August 2 2006 9:44pm
Subject:RE: Doing a join
View as plain text  
Yeah, I just figured it out ten minutes ago, one of those stupid little
oversites on my part.

-----Original Message-----
From: Martin Jespersen [mailto:mbj@stripped] 
Sent: Wednesday, August 02, 2006 3:40 PM
To: John Meyer
Cc: mysql@stripped
Subject: Re: Doing a join

select g.GROUP_NAME, count(mg.MEM_ID) as NUMBER_OF_MEMBERS from GROUPS g
left join MEM_GRO mg using(GRO_ID) group by g.GRO_ID


John Meyer wrote:
> I have two tables:
> 
> 
> MEMBERS:
> MEM_ID
> ...
> 
> GROUPS:
> GRO_ID:
> ...
> 
> And one joiner
> 
> MEM_GRO:
> MEM_ID, GRO_ID
> 
> 
> I want to print out a list like this
> 
> GROUP_NAME, NUMBER_OF_MEMBERS
> 
> Even when the number of members is 0, how do I do that?
> 
> 
> 


Thread
Doing a joinJohn Meyer2 Aug
  • Re: Doing a joinMartin Jespersen2 Aug
    • RE: Doing a joinJohn Meyer2 Aug
  • Re: Doing a joinJay Pipes3 Aug
    • RE: Doing a joinJohn Meyer3 Aug