sql查询应用小于/大于条件的字符串

时间:2018-05-18 11:52:05

标签: sql

我需要进行sql查询,但到目前为止还没有管理... 我需要通过模型获得参考'400a'和'850a'之间的结果......我怎样才能实现这一目标?你可以看到我的照片更好地理解..

我可以帮助我吗?

我当前的sql server查询是:

选择

Model,IndexOp,Reference,value FROM table

,其中

IndexOp> =(选择IndexOp FROM表,其中Model ='405a',Reference ='850a')和

IndexOp< =(选择IndexOp FROM表,其中Model ='405a',Reference ='850a')

但它不起作用:错误:子查询返回多行

my problem - in picture below

1 个答案:

答案 0 :(得分:1)

您只是在寻找where条款吗?

select t.*
from t
where reference >= '405a' and reference <= '850a';

这不是一个复杂的查询。