-1

Help me create a hierarchical query.
I have two table:

Table 1(dic_kgs)

KGS_ID    KGS_PARENT_ID    KGS_CODE
1                           A  
2              1            A0
3              1            A1
4                           B

and so on

Table 2(dic_kgs_strings)

KGS_ID    LANG_ID    KGS_NAME    KGS_ADD_INFO
1            1        Name1
2            1        Name2
3            1        Name3 
4            1        Name4

and so on.

I want to get result in the follow view:

A Name1
A0 Name2
A1 Name3
B Name4

I have writen only part of query:

select kgs_code
  from dic_kgs 
  start with dic_kgs.kgs_parent_id is null
      connect by prior dic_kgs.kgs_id = dic_kgs.kgs_parent_id;  

Thanks.

user348173
  • 8,818
  • 18
  • 66
  • 102
  • 1
    Obviously DIC_KGS has a hierarchical structure but you're not using it in your query. So what is the point you're trying to reach – APC Aug 03 '11 at 07:37

1 Answers1

0

it not seems to be a hierarchical query what you need.

You can get the report using:

select 
   kgs_code, kgs_name 
from
   dic_kgs a join dic_kgs_strings b on (a.kgs_id = b.kgs_id)
Florin Ghita
  • 17,525
  • 6
  • 57
  • 76