problem to find record between perticular value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikassawant
    New Member
    • Mar 2009
    • 27

    problem to find record between perticular value

    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
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    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+"'" ;

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      Without "IN"

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

      Regards
      Veena

      Comment

      Working...