日期:2014-05-17 浏览次数:20589 次
declare @c table (c1 tinyint,c2 tinyint,c3 tinyint,c4 tinyint,c5 tinyint,c6 tinyint,c7 tinyint,c8 tinyint,c9 tinyint,c10 tinyint,c11 tinyint,c12 tinyint)
--该表做笛卡尔积
declare @t table (p tinyint)
insert into @t
select 1
union all select 2
union all select 3
union all select 4
union all select 5
union all select 6
union all select 7
union all select 8
union all select 9
union all select 10
union all select 11
union all select 12
insert @c
select
*
from @t t1
cross join @t t2 cross join @t t3 cross join @t t4 cross join @t t5 cross join @t t6 cross join @t t7 cross join @t t8 cross join @t t9 cross join @t t10 cross join @t t11 cross join @t t12
where t1.p=1
--竖
and t1.p<>t2.p and t1.p<>t3.p and t1.p<>t4.p and t1.p<>t5.p and t1.p<>t6.p and t1.p<>t7.p and t1.p<>t8.p and t1.p<>t9.p and t1.p<>t10.p and t1.p<>t11.p and t1.p<>t12.p
and t2.p<>t3.p and t2.p<>t4.p and t2.p<>t5.p and t2.p<>t6.p and t2.p<>t7.p and t2.p<>t8.p and t2.p<>t9.p and t2.p<>t10.p and t2.p<>t11.p and t2.p<>t12.p
and t3.p<>t4.p and t3.p<>t5.p and t3.p<>t6.p and t3.p<>t7.p and t3.p<>t8.p and t3.p<>t9.p and t3.p<>t10.p and t3.p<>t11.p and t3.p<>t12.p
and t4.p<>t5.p and t4.p<>t6.p and t4.p<>t7.p and t4.p<>t8.p and t4.p<>t9.p and t4.p<>t10.p and t4.p<>t11.p and t4.p<>t12.p
and t5.p<>t6.p and t5.p<>t7.p and t5.p<>t8.p and t5.p<>t9.p and t5.p<>t10.p and t5.p<>t11.p and t5.p<>t12.p
and t6.p<>t7.p and t6.p<>t8.p and t6.p<>t9.p and t6.p<>t10.p and t6.p<>t11.p and t6.p<>t12.p
and t7.p<>t8.p and t7.p<>t9.p and t7.p<>t10.p and t7.p<>t11.p and t7.p<>t12.p
and t8.p<>t9.p and t8.p<>t10.p an