select `id`,`name`,`pid` AS `q_pid`,(select id From qiyu_gift_category where id = q_pid ) as root_id from qiyu_gift_category WHERE id = 1
SELECT `id` FROM `qiyu_gift_category` WHERE id = (SELECT pid FROM qiyu_gift_category WHERE id = 1) LIMIT 1
二级菜单通过一个ID查找父级ID,布布扣,bubuko.com
时间: 2024-10-21 13:20:46