Solved

Query Help

Posted on 2011-03-10
4
280 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.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
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

705 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

21 Experts available now in Live!

Get 1:1 Help Now