sql 计算4!使用recursive with子句

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 计算4!使用recursive with子句相关的知识,希望对你有一定的参考价值。

WITH RSFC(ITERATION,RUNNING_FACTORIAL) AS
  ( SELECT NUM AS ITERATION, 1 AS RUNNING_FACTORIAL FROM NUMBERS WHERE NUM =1
  UNION ALL
  SELECT R.ITERATION +1,
    R.RUNNING_FACTORIAL * B.NUM
  FROM RSFC R
  INNER JOIN NUMBERS B
  ON (R.ITERATION+1) = B.NUM
  )
SELECT iteration,running_factorial FROM rsfc

以上是关于sql 计算4!使用recursive with子句的主要内容,如果未能解决你的问题,请参考以下文章

SQL案例分析-地铁换乘线路查询.sql

MySQL - WITH RECURSIVE AS 递归查询

MySQL - WITH RECURSIVE AS 递归查询

MySQL - WITH RECURSIVE AS 递归查询

mybatis+postgresql WITH RECURSIVE cte as

zkTree: a zk recursion tree with ZKP membership proofs