更正 --> 测试数据[TB1] if object_id('[TB1]') is not null drop table [TB1] go create table [TB1]([notext] nvarchar(20),[blu] nvarchar(2),[倍投数] int) insert [TB1]select '01 06 08 13 20 28','10',4 union all select '13 22 26 27 28 29','16',7 union all select '05 09 11 19 27 33','11',1 union all select '02 05 09 23 29 33','13',4
--> 测试数据[TB1]
if object_id('[TB1]') is not null drop table [TB1]
go
create table [TB1]([notext] nvarchar(20),[blu] nvarchar(2),[倍投数] int)
insert [TB1]select '01 06 08 13 20 28','10',4 union all
select '13 22 26 27 28 29','16',7 union all
select '05 09 11 19 27 33','11',1 union all
select '02 05 09 23 29 33','13',4
if object_id('[TB1]') is not null drop table [TB1]
go
create table [TB1]([notext] nvarchar(20),[blu] nvarchar(2),[倍投数] int)
insert [TB1]select '01 06 08 13 20 28','10',4 union all
select '13 22 26 27 28 29','16',7 union all
select '05 09 11 19 27 33','11',1 union all
select '02 05 09 23 29 33','13',4
go
--补足记录
select notext,blu,[倍投数]
from [TB1] t,master..spt_values s
where s.type = 'P' and s.number >=1 and s.number <= [倍投数]
order by [倍投数]
/*
notext blu 倍投数
05 09 11 19 27 33 11 1
02 05 09 23 29 33 13 4
02 05 09 23 29 33 13 4
02 05 09 23 29 33 13 4
02 05 09 23 29 33 13 4
01 06 08 13 20 28 10 4
01 06 08 13 20 28 10 4
01 06 08 13 20 28 10 4
01 06 08 13 20 28 10 4
13 22 26 27 28 29 16 7
13 22 26 27 28 29 16 7
13 22 26 27 28 29 16 7
13 22 26 27 28 29 16 7
13 22 26 27 28 29 16 7
13 22 26 27 28 29 16 7
13 22 26 27 28 29 16 7
*/