Mysql 查询根节点下所有叶子节点

时间:2022-06-19 17:39:05
【文件属性】:

文件名称:Mysql 查询根节点下所有叶子节点

文件大小:29KB

文件格式:PNG

更新时间:2022-06-19 17:39:05

mysql

1、SELECT * FROM ( SELECT d.id, ( SELECT count( 1 ) FROM t_tree dd WHERE dd.parent_uuid = d.id ) AS count FROM t_tree d ) a WHERE a.count =0; 2、SELECT t3.id FROM t_tree t3 WHERE t3.id NOT IN ( SELECT t1.id FROM t_tree t1, t_tree t2 WHERE t1.id = t2.parent_uuid )


网友评论