- mysql> with recursive workingTable (fibNum, NextNumber, index1)
- -> as
- -> (select 0,1,1
- -> union all
- -> select fibNum+nextNumber,fibNUm,index1+1
- -> from workingTable
- -> where index1<20)
- ->
- -> select fibNum from workingTable as fib;
- +--------+
- | fibNum |
- +--------+
- | 0 |
- | 1 |
- | 1 |
- | 2 |
- | 3 |
- | 5 |
- | 8 |
- | 13 |
- | 21 |
- | 34 |
- | 55 |
- | 89 |
- | 144 |
- | 233 |
- | 377 |
- | 610 |
- | 987 |
- | 1597 |
- | 2584 |
- | 4181 |
- +--------+
- 20 rows in set (0.00 sec)