How to make hierarchical structure for the flat table

masoud_sedighy

Registered User.
Local time
Yesterday, 19:40
Joined
Dec 10, 2011
Messages
132
Hello

I have 5 tables with below design

Table 1 : Docid (pk),DocNo

Table 2: Transid (pk),Transmittal No

Table 3: Docid (fk to table1),TransID(fk to table2)

Table 4: TransmittatoConID(PK), TransmittaltoCon

Table 5: Docid(fk to table 3),transID(FK to table3), TransmittatoConID(PK)
“combine fields”

I have made a query from top tables that returns the below data

DocNo TransmittalNo TransmittaltoCon

Doc-0001 tt-0002 con-0005

Doc-0005 tt-0002 con-0003

Doc-0001 tt-0002 con-0007

Now I like to make a query with adding new fields (parent) , (position) that shows

hierarchical structure of the fields

level 1 is (Doc No) level 2 is (Transmittal No) and level 3 is (TransmittaltoCon) ,

ID PARENT POSITION OPTION

1 0 0 DOC-0001​
2 1 0 TT-0002​
3 0 1 DOC-0005​
4 1 1 CON-0007​
5 3 0 TT-0002​
6 5 0 CON-0003​
 
Last edited:

Users who are viewing this thread

Back
Top Bottom