我有一个表说“Table1”,其中有大量数据存储在列名“Value”下,我有另一个表说“Table2”,其中包含“from”和“to”列。我想对“Table1”的“value”列执行“between”操作,操作数将来自“Table2”的“from”和“to”列。
例如:
Table1 Value
-------
10
11
12
13
14
15
Table2 from to
--------------
1 3
4 10
5 15
operations to be performed: select value from Table1 where value between 1 and 3
select value from Table1 where value between 4 and 10
select value from Table1 where value between 5 and 15
输出将是这三个操作的联合。
PS它们之间没有共同的列。