You can create as many numbers as you desire from the Fibonacci Series using the query below. Change the value in the WHERE clause to change the number of the items in the list.
WITH Fibonacci
AS (SELECT 0 AS A,
0 AS B,
1 AS Seed,
1 AS Number
UNION ALL
SELECT Seed + A,
A + B,
A,
Number + 1
FROM Fibonacci
WHERE Number < 20)
SELECT A AS [Fibonacci Series]
FROM Fibonacci;
コメント