MySQL Forums
Forum List  »  Knowledge Base

JOINING PROBLEM
Posted by: Samwel Muro
Date: September 15, 2008 06:27AM

Please assist... I have the following table
Table: person
CREATE TABLE `person` (
`region` varchar(20) collate latin1_general_ci default NULL,
`name` varchar(20) collate latin1_general_ci default NULL,
`gender` char(2) collate latin1_general_ci default NULL,
);

insert into person (’UK’,'Steve’,'m’);
insert into person (’UK’,'Marie’,'f’);
insert into person (’UK’,'Rob’,'m’);
insert into person (’US’,'Bob’,'m’);
insert into person (’US’,'Michele’,'f’);
insert into person (’NL’,'Jim’,'m’);

Now i want to issue a query which will display in one row the number of male and female per region
That should be

Region|M_Count|F_Count
UK|2|1
US|1|1
NL|1|0

Please advice

Options: ReplyQuote


Subject
Views
Written By
Posted
JOINING PROBLEM
3144
September 15, 2008 06:27AM
1939
September 17, 2008 12:59PM
1979
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.