如何把双色球的红球所有组合排出来(SQL)

SELECT TOP 33 id=identity(int,1,1) INTO #1 FROM sysobjects

SELECT A.id ,B.id,C.id,D.id,E.id,F.id
FROM #1 A,#1 B,#1 C,#1 D,#1 E,#1 F
WHERE A.IDAND B.IDAND C.IDAND D.IDAND E.IDORDER BY A.id,B.id,C.id,D.id,E.id,F.id

 

--result : 1107568 SQL Server 2005 46's

 

-- 创建号码表(1-33)tb_rednum

SELECT TOP 33 id=identity(int,1,1) INTO dbo.tb_rednum FROM sysobjects

 

-- 创建结果表 (所有组合) tb_allred

SELECT A.id num01 ,B.id num02,C.id num03,D.id num04,E.id num05,F.id num06 into dbo.tb_allred

FROM tb_rednum A,tb_rednum B,tb_rednum C,tb_rednum D,tb_rednum E,tb_rednum F
WHERE A.IDAND B.IDAND C.IDAND D.IDAND E.ID

 

 

你可能感兴趣的:(杂类)