posted 10/27/2011 by timmurphy - Views: [26433]
WITH t ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13]) AS
( SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13
UNION ALL
SELECT
[1] + 1
,[2] + 2
,[3] + 3
,[4] + 4
,[5] + 5
,[6] + 6
,[7] + 7
,[8] + 8
,[9] + 9
,[10] + 10
,[11] + 11
,[12] + 12
,[13] + 13
FROM t WHERE [1] < 13
)
SELECT [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13] FROM t
I know you may never need this (the multiplication table that is), but I hope it at least gets you thinking recursively anyway. Of course it would have been nice to have this in the 2nd Grade.