在SQL查询中不起作用的两个值之间 [英] between two values not working in SQL Query

查看:82
本文介绍了在SQL查询中不起作用的两个值之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

选择范围不在sql语句中.

selection range not coming in the sql statement.

select * from tab1 where startsal between '10' and '89' and Endsal between '2010' and '8800'


对于上述情况将不会有任何结果.但是,应该显示所有
值从10开始到89,再到2010年达到8800
查看我的数据


nothing will coming for the above condition. but, it is suppose to display all the
values from 10 onwards to 89 and 2010 to 8800
see my data

------------------------
StartSal	EndSal
------------------------
30      	2011
60      	2022
20      	2011
15      	2031
9       	2047
8       	3400
4       	4500
2       	5600
1       	4600
20      	3900
50      	5100
70      	6700
89      	8800

推荐答案

尝试一下

Try this

select * from tab1 where startsal between 1 and 89 and Endsal between 2010 and 8800


我已经执行了这个查询,并给出了结果...
这可能对您有帮助.
不要在字符串值中包含单引号...

从sal中选择Count(*),起始点在10到80之间,结束点在20000到40000之间
I have executed this querry and giving result...
this may help you..
Dont include single quotes for string values...

select Count(*) from sal where startsal between 10 and 80 and endsal between 20000 and 40000


这篇关于在SQL查询中不起作用的两个值之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆