怎么写 SQL 能查询红色(无子项)排除蓝色(有子项)?
相关帖子
-
- 其他回帖
-
-
-
WITH RECURSIVE finish_tree AS ( -- 非递归部分:选择根分类 SELECT id, parent_id FROM blocks WHERE markdown like "* [x]%" and type = 'i' and subtype = 't' UNION ALL -- 递归部分:选择所有子分类 SELECT fi.id, fi.parent_id FROM blocks as fi INNER JOIN finish_tree as ft ON fi.parent_id = ft.id ) select * from blocks where id not in (select id from finish_tree) and root_id = '20240522181405-mdiudfl' and type = 'i' and subtype = 't' limit 10
3 回复 - 查看全部回帖