我打算同时根据列值选择多个间隔。这是可能的
这是我的样本数据,它由1024行组成,我想根据波长列选择多个区间ex:(341-348)(551-664)(998-1021)来自单个表
答案 0 :(得分:1)
您应该使用BETWEEN
和OR
来获取记录:
SELECT * FROM TABLE1
WHERE wavelenght BETWEEN 341 AND 348
OR wavelenght BETWEEN 551 AND 664
OR wavelenght BETWEEN 998 AND 1021
答案 1 :(得分:0)
要查询不是特定值,而是查询一系列值,SQL为BETWEEN
子句(http://www.w3schools.com/sql/sql_between.asp)发明了WHERE
运算符,例如
SELECT columns
FROM yourtable
WHERE wavelength BETWEEN lowerbound AND upperbound;