Connecting Tech Pros Worldwide Help | Site Map

problem to find record between perticular value

Newbie
 
Join Date: Mar 2009
Location: Kolhapur,Maharastra,India
Posts: 26
#1: Mar 9 '09
hi all,
I wanna find record in between particular range of value.

e.g. i want to find all the records whose RBI is between 10 to 50
my query is,
query = "select * from Offense where RBI= (select RBI from Offense where RBI between "+rbiv1+" and "+rbiv2+" and FirstName <>'"+str1+"' and LastName <>'"+str2+"')";

sub query return null,due to which I can't get the resulting records.

Please tell me what is the mistake in this query.

How to write query to access value between two ranges?


Thanks
vikas
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,497
#2: Mar 9 '09

re: problem to find record between perticular value


try using the following

query = "select * from Offense where RBI in (select RBI from Offense where RBI between "+rbiv1+" and "+rbiv2+" and FirstName <>'"+str1+"')" and LastName <>'"+str2+"'";
QVeen72's Avatar
Moderator
 
Join Date: Oct 2006
Location: Bangalore
Posts: 1,385
#3: Mar 9 '09

re: problem to find record between perticular value


Hi,

Without "IN"

query = "Select * from Offense where RBI between " + rbiv1 + " and " + rbiv2 + " and FirstName <> '" + str1 + "' and LastName <> '" + str2 + "'";

Regards
Veena
Reply