If object_id (' tempdb for. Dbo. # tb1) is not null drop table # tb1
Go
The create table # tb1 ((TTM) varchar (20))
Insert # tb1
Select 'week1' union all
Select 'week2' union all
Select 'week4' union all
Select 'week6' union all
Select 'week7' union all
Select 'week8' union all
Select 'week9' union all
Select 'week10' union all
Select 'week11'
If object_id (' tempdb for. Dbo. # tb2) is not null drop table # tb2
Go
The create table # tb2 ([NNA] varchar (20))
Insert # tb2
Select 'team1' union all
Select 'team2' union all
Select 'team3'
- execute code to TTM has 555 records, the result of the request line 19 NNA in sequence from the first week1 sequence of combination, until completion of the combination in sequence,
Rids TTM NNA
__________________
1 week1 team1
2 week2 team2
3 week3 team3
4 week4 team1
5 week5 team2
6 week6 team3
7 week7 team1
8 week8 team2
9 week9 team3
10 week10 team1
11 week11 team2