Home > database >  [for] ORACLE father-son relationship data to the ground
[for] ORACLE father-son relationship data to the ground

Time:11-18

The existing two tables
A table: the relationships of nodes stored
Table B: business table, store business data
Now need according to A, B table, the data to be born to C in the table, to realize the father-son relationship,
The sample is as follows:
A table
The primary key parent node
ID leader User
1
0 competent business A2 the competent business A salesman B
3 the competent business A salesman C
4 business executives A salesman D

Table B
Id user level grade
The head of A 1 10
2 clerk B 1 30
3 the salesman 2 C 20
4 salesman 3 D 10

C table:
Id user leader level grade
1 head of A 0 1 70
2 10 head of A head of A 1
3 the salesman B head of A 30
14 salesman competent business A 2 C 20
The salesman D head of A 10 3


CodePudding user response:

A subordinate relations in the table, there is only one layer? There are still not sure the number of layers?
  • Related