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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 correcting a simple join

Author  Topic 

idb65
Starting Member

4 Posts

Posted - 2013-04-30 : 17:37:35
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 - 2013-04-30 : 20:41:21
[code]
select mem.organization,sum(co.population)
from country co
join is_member mem
on co.country_code=mem.country_code
group by mem.organization;
[/code]
Go to Top of Page

idb65
Starting Member

4 Posts

Posted - 2013-05-01 : 03:13:57
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
   

- Advertisement -