firebird的递归查询
1 with RECURSIVE cte as ( 2 select a.* from PM_PROJECT a where a.pm_id='root_id' 3 union all 4 select k.* from PM_PROJECT k join cte c on c.pm_id =k.pm_parent 5 ) 6 select * from cte
表结构:
pm_id
pm_parent
pm_name
只可惜,目前只有自上而下的查询。
SELECT GEN_ID(gen_projectid, 1) FROM RDB$DATABASE;
解决多层自增字段的简单有效办法