我有一张如下表所示的表......
ID Price
==== ======
1 1000
2 2000
3 4000
4 5000
现在我需要一个查询来选择值between 500 and 1500
和between 2500 and 4500
。即在单个选择查询中使用两个......
有可能吗?
输出应该是:ID Price
==== ======
1 1000
3 4000
答案 0 :(得分:7)
select id, price
from tablename
where price between 500 and 1500
or price between 2500 and 4500