34,838
社区成员




找出100以内所有的索数
条件:不能用循环 结果是这样的
1
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
这是别人写的两种方法
select top 100 px=identity(int,1,1) into # from sysobjects
--方法1取模
select px from # where px<>1 and px%2 <>0 and px%3<>0 and px%5<>0 and px%7<>0 or px=2 or px=5 or px=3 or px=7
--方法2不等于乘积
select * from #
where px>1 and px not in
(select a.px*b.px from # a, # b where a.px>1 and b.px>1)