你可以先准备一张表 xxx (id int) 其中包含1 到10000000所有的整数。 这样你可以直接select id from xxx where id between 6 between 10;
TO: ACMAIN_CHM我刚才问的问题可能没有说完全。 已经知道的上下限数值是存在于另一个表 其表结构如下 ID | U0 | D0 | U1 | D1 1 10 6 8 5是想根据这里所记录的上下限信息。生成一个新表 ID 6 7 8 9 10 5 6 7 8
纠正下,老狼笔误 select and from xxx where id between 6 and 10;
select b.id from 另一个表 a ,xxx b where a.id=1 and b.id between a.UO and a.DO union all select b.id from 另一个表 a ,xxx b where a.id=1 and b.id between a.U1 and a.D1
这样你可以直接select id from xxx where id between 6 between 10;
已经知道的上下限数值是存在于另一个表
其表结构如下
ID | U0 | D0 | U1 | D1
1 10 6 8 5是想根据这里所记录的上下限信息。生成一个新表
ID
6
7
8
9
10
5
6
7
8
select and from xxx where id between 6 and 10;
from 另一个表 a ,xxx b
where a.id=1
and b.id between a.UO and a.DO
union all
select b.id
from 另一个表 a ,xxx b
where a.id=1
and b.id between a.U1 and a.D1