Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
selection range not coming in the sql statement.
SQL
select * from tab1 where startsal between '10' and '89' and Endsal between '2010' and '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
Posted
Updated 16-Jan-12 23:34pm
v4
Comments
Selva K 17-Jan-12 5:17am    
Your data is between that condition only, Check your question..
Md. Rashim Uddin 17-Jan-12 5:25am    
It should work...
Prasad_Kulkarni 17-Jan-12 5:27am    
no error
Amir Mahfoozi 17-Jan-12 5:35am    
What are the data types of StartSal and EndSal ?
gani7787 17-Jan-12 5:44am    
both are integer data type

Try this

SQL
select * from tab1 where startsal between 1 and 89 and Endsal between 2010 and 8800
 
Share this answer
 
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
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900