美文网首页
mysql 获取pid集合

mysql 获取pid集合

作者: 发条家的橙子 | 来源:发表于2022-03-14 17:19 被阅读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

相关文章

网友评论

      本文标题:mysql 获取pid集合

      本文链接:https://www.haomeiwen.com/subject/urksdrtx.html