database - Multiple self-referencing foreign key -


i want create mapping table this:

mis_report_struc_main (   m_id          nvarchar2(3) not null,   m_name        nvarchar2(200),   main_head     nvarchar2(3),   sub_head      nvarchar2(3),   tot_head      nvarchar2(3),   sub_tot_head  nvarchar2(3) ); 

where m_id primary key , main_head, sub_head, tot_head, sub_tot_head self-referencing foreign keys.

please me write sql.

if should not possible, explain why.

here example

select * mis_report_struc_main t left outer join mis_report_struc_main t_mh on t.main_head = t_mh.m_id left outer join mis_report_struc_main t_sh on t.main_head = t_sh.m_id left outer join mis_report_struc_main t_th on t.main_head = t_th.m_id left outer join mis_report_struc_main t_sth on t.main_head = t_sth.m_id 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -