MySQL Forums
Forum List  »  Knowledge Base

Re: JOINING PROBLEM
Posted by: Martin Curtains
Date: September 17, 2008 12:59PM

Hi Samwel,

SELECT
p.region,
(SELECT COUNT(*) FROM person WHERE region = p.region AND gender = 'm') AS m_count,
(SELECT COUNT(*) FROM person WHERE region = p.region AND gender = 'f') AS f_count
FROM person p
GROUP BY p.region

Options: ReplyQuote


Subject
Views
Written By
Posted
3144
September 15, 2008 06:27AM
Re: JOINING PROBLEM
1938
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.