数据库表A,字段 节点id,父节点father_id
A
B A
C A
D B
E C
F C
G D
H E
用sql查出G的所有上层节点,结果如下:
id father_id
A
B A
D B
G D