你的数据有问题啊。 表结构应该是这样的 ( id pid name );只有这样才能查询到指定id对应的,名称和父结点的名称啊。
select ID,cname,oname FROM TABLE T WHERE T.PID='' LZ是想查根据PID=多少来查询码?
select level,cos.org_subjection_id,cos.org_id,coi.org_name,cos.father_org_id from comm_org_subjection cos,comm_org_information coi where cos.org_id = coi.org_id start with cos.father_org_id='0' connect by prior cos.org_subjection_id =cos.father_org_id;类似于这样的语句,使用start with connect by prior 来对父子结点分层,了解父子结点的一个层级结构
表结构应该是这样的
(
id
pid
name
);只有这样才能查询到指定id对应的,名称和父结点的名称啊。
from comm_org_subjection cos,comm_org_information coi
where cos.org_id = coi.org_id
start with cos.father_org_id='0'
connect by prior cos.org_subjection_id =cos.father_org_id;类似于这样的语句,使用start with connect by prior 来对父子结点分层,了解父子结点的一个层级结构