Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Generating a double sequence of integers in T-SQL with CTE

$
0
0

Hello,

I know how to generate a single sequence of integers with CTE :

;with cte(i)
as
(
	select 1 as i 
	union all
	select i+1 from cte where i<10
)
select * from cte

But how do I generate a double sequence with the same technique  ? I would like to obtain such a result :

1,1

1,2

...

1,10

2,1

2,2

...

2,10

3,1

etc..


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>