mysql 获取pid集合

2022-03-14  本文已影响0人  发条家的橙子
image.png
SELECT GROUP_CONCAT(t2.id)
FROM
    (
        SELECT 
        @r AS _id,
        (SELECT @r := parent_id FROM zcm_users WHERE id = _id) AS parent_id
        FROM
        (SELECT @r := 25) vars, zcm_users 
        WHERE @r <> 0 
    ) t1
JOIN zcm_users t2
ON t1._id = t2.id
image.png
上一篇 下一篇

猜你喜欢

热点阅读