Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Get top 10 cities per country

450482Aug 27 2007 — edited Aug 28 2007
Hi
I am trying to fetch top 10 cities by population for countries listed in the IN clause.

select * from (
Select city_name, population...
from test
where country in ('China','India', 'USA')
order by population
)
where rownum <=10.

What I need as an output is total of 30 rows in this case, 10 for India, 10 for US and 10 for China.

What am I doing wrong here? I get more rows.
Any help appreciated.

Thx!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 25 2007
Added on Aug 27 2007
3 comments
1,376 views