如何从同一张表获得父子关系 [英] How to get parent child relation from same table
本文介绍了如何从同一张表获得父子关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想知道如何编写查询以从同一表中获取父级子代
0印度人
公元前
Bcm
Mbc
Mbc1
Sc
SCA
0国际
新加坡
singaporean1
这是单个表,字段是这样的
hi all,
i want to know how to write query to get parent child from same table means
0 indian
Bc
Bcm
Mbc
Mbc1
Sc
Sca
0 International
singaporean
singaporean1
this is single table,and fields are like this
id parent id category name level
1 0 Indian 1
2 0 international 1
3 1 BC 2
4 1 MBC 2
5 1 SC 2
6 3 BCM 3
7 4 MBC1 3
8 5 SCA 3
9 2 Singaporean 4
10 9 Singaporean1 5
提供解决此问题的方法.
谢谢与问候
sujitharam ...
Give the solution for this question.
Thanks and Regards
sujitharam...
推荐答案
pl检查以下线程:
http://stackoverflow.com/questions/943507/mysql-parent-child-query [ ^ ]
pl check the following thread:
http://stackoverflow.com/questions/943507/mysql-parent-child-query[^]
这篇关于如何从同一张表获得父子关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文