WITH RECURSIVE cte AS ( SELECT id,pid from szyt_base_industy where id <choose> <when test=" category != null"> = #{category} </when> <otherwise> IN <foreach item="item" index="index" collection="categorys" open="(" separator="," close=")"> #{item} </foreach> </otherwise> </choose> union all SELECT a.id,a.pid from szyt_base_industy a inner join cte c on a.pid=c.id) select cte.id from cte)
postgrel sql的递归
最新推荐文章于 2022-11-01 18:57:06 发布