MySQL Forums
Forum List  »  Knowledge Base

Re: JOINING PROBLEM
Posted by: Jeff Doak
Date: September 22, 2008 10:25PM

Here's how I would do it:
select region,sum(if(gender='m',1,0)) as M_Count,sum(if(gender='f',1,0)) as F_Count from person group by region;

Of course this isn't actually a join problem more just a query, function or grouping problem.

Options: ReplyQuote


Subject
Views
Written By
Posted
3190
September 15, 2008 06:27AM
1956
September 17, 2008 12:59PM
Re: JOINING PROBLEM
1992
September 22, 2008 10:25PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.