?
Solved

Query Help

Posted on 2011-03-10
4
Medium Priority
?
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Akenathon earned 750 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 750 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

764 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