业务中栏目表是树形接口的,要返回指定节点下所有的子节点,sql语句如下:
SELECT
category_id,
parent_id,
category_name,
level,
sort,
subject_id,
subject_name,
period
FROM
(SELECT
category_id,
parent_id,
category_name,
level,
sort,
subject_id,
subject_name,
period
FROM
cms_category) T1,
(SELECT
@pid := 36792) T2
WHERE FIND_IN_SET(parent_id, @pid) > 0
AND @pid := CONCAT(@pid, ',', category_id) ;