Solved

Query Help

Posted on 2011-03-10
4
281 Views
Last Modified: 2012-05-11
Hi,
  Please find the attached file for the table export data. It has id, name and containingregion columns.
containingregion column has id which connects to other location in the same table.

My problem here is  when I give an id I need to get country for that id and continent for that ID in two queries. my problem here is some times the ID might be county record, some times the ID might be state ID..when I give ID I need to get country, state and continent. if the id is country id, then I need to get state as null, country as this record and continent should be the continent of the record.

I need it in three queries, one for state, one for country and one for continent. Please let me know how can I do it.

Thanks
table-export.xls
0
Comment
Question by:Sthokala
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Akenathon earned 250 total points
ID: 35096983
Please post your expected results as a spreadsheet, it's difficult to follow the written explanation.
0
 
LVL 2

Assisted Solution

by:swadhinray
swadhinray earned 250 total points
ID: 35124932
Name is the country name what you are expecting but I think there should be one more table containing your location and continent information.

Boz one continent can have multiple location and you location which ID in your file should always be unique so based on that you need to make a relation and get the expected result and as Akenathon: said to provide a expected result then it will be easier to understand what you are looking for as when i did a select on each ID I am able to get the result like below:

ID      NAME      REGIONCODE      CONTAININGREGION      STATE_PROVINCE_IND      REGION_TYPE
3975      United States      US      3965      N      CNTRY


Which seems to be a good data.

Better to provide a expected result you are looking for.
0
 

Author Comment

by:Sthokala
ID: 35131315
Thanks Guys for your rsponse. I found the solution for this.
0
 

Author Closing Comment

by:Sthokala
ID: 35131330
Found solution
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now