SELECT
id
FROM
(
SELECT
t1.id,
IF (
find_in_set(parent_id, @pids) > 0,
@pids := concat(@pids, ‘,‘, id),
0
) AS ischild
FROM
(
SELECT
id,
parent_id
FROM
rde_menu t
WHERE
t. menu_status = 1
ORDER BY
parent_id,
id
) t1,
(SELECT @pids := 要查询的节点id) t2
) t3
WHERE
ischild !=0
时间: 2024-11-10 15:39:30