MySQL Forums
Forum List  »  Newbie

Re: Problems with a comlicated select
Posted by: Ramalingam Chelliah
Date: April 17, 2005 10:44PM

Hi,

Check if this helps you...

SELECT p.name, COUNT( IF(u.country_id=1,p.name,NULL)) as 'Germany',
COUNT( IF(u.country_id=2,p.name,NULL)) as 'England',COUNT( IF(u.country_id=3,p.name,NULL)) as 'USA'
FROM
users as u, position as p, country c
WHERE u.position_id=p.id AND u.couintry_id=c.id
GROUP BY p.name;

Regards,
Ram.

We Learn the Most When we have to Invent

Options: ReplyQuote


Subject
Written By
Posted
Re: Problems with a comlicated select
April 17, 2005 10:44PM


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.