Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 correcting a simple join
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

idb65
Starting Member

4 Posts

Posted - 04/30/2013 :  17:37:35  Show Profile  Reply with Quote
Hello my friends

i have these to tables

country: country_code,population
is_member: organization,country_code


now i want name of organizations with the sum of the population of their members countries

i wrote this but i think it is not correct

selec mem.organization,sum(co.population)
from country co
join is_member mem
on co.country_code=mem.country_code;


thank u so much for ur help

I use oracle 11g

best

singularity
Posting Yak Master

153 Posts

Posted - 04/30/2013 :  20:41:21  Show Profile  Reply with Quote

select mem.organization,sum(co.population)
from country co
join is_member mem
on co.country_code=mem.country_code
group by mem.organization;
Go to Top of Page

idb65
Starting Member

4 Posts

Posted - 05/01/2013 :  03:13:57  Show Profile  Reply with Quote
Thank you so much.


quote:
Originally posted by singularity


select mem.organization,sum(co.population)
from country co
join is_member mem
on co.country_code=mem.country_code
group by mem.organization;


Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.19 seconds. Powered By: Snitz Forums 2000