| 发表于:2008-01-07 11:52:566楼 得分:0 |
哈哈,终于解决了,看看我的示例: 我建了个 tblno的表,表里就一个字段 tno char(1) 假设是个3位数的彩票: 3个条件:第1位小,第2位质,第3位奇,容错2个: select t1.tno+t2.tno+t3.tno from tblno as t1,tblno as t2,tblno as t3 where ((case when cast(t1.tno as tinyint) <=4 then 1 else 0 end)+ (case when dbo.isprime(cast(t2.tno as tinyint))=1 then 1 else 0 end)+ (case when cast(t3.tno as tinyint) %2=0 then 1 else 0 end)) <=2 | | |
|