时间:2021-07-01 10:21:17 帮助过:30人阅读
DROP FUNCTION IF EXISTS PersonName;
CREATE FUNCTION PersonName(parent_id smallint) RETURNS VARCHAR(20) DETERMINISTIC
RETURN (SELECT job_name FROM qx_people_resource WHERE id_=parent_id);
SELECT PersonName(id_) AS child, PersonName(parent_id) AS parent
FROM qx_people_resource;
参考:http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html#adjacency_list_model
树形查询sql
标签:参考 har pos sele sof res child char enc