Re: factorial
From: Fan Ruo Xin <fanruox_at_yahoo.com>
Date: Sun, 06 Jan 2002 05:06:19 GMT
Message-ID: <3C37DB75.6AC77849_at_yahoo.com>
Date: Sun, 06 Jan 2002 05:06:19 GMT
Message-ID: <3C37DB75.6AC77849_at_yahoo.com>
try this:
( values(1, 1, 1)
Just wonder why use sql to do this kind of thing?
Regards,
Fan Ruo Xin
Mikito Harakiri wrote:
> WITH
with factorial (level, n, f) as
union all
select level+1, n+1, f*(n+1)
from factorial
where level<10
)
select * from factorial;
> factorial AS (
> select n+1, f*(n+1) from factorial
> union
> select 1, 1 from table(values(1,1)) )
> SELECT f FROM factorial
> WHERE n=5
>
> 1. Is this going to work?
> 2. If not why, and what would be the correct recursive definition?
Received on Sun Jan 06 2002 - 06:06:19 CET