Results 1 to 4 of 4
  1. #1
    VAer's Avatar
    VAer is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2016
    Location
    USA
    Posts
    163

    Is this kind of SQL DELETE statement valid?

    The code is just an example. Is it okay to have same values in BETWEEN...AND statement? You may wonder why I do not write it as Price = 10, because I would like to replace the two numbers with two textbox input values(the code is behind the scene, and user will not see it), let us say there are two input textbox, LowerLimit and UpperLimit. If user enters 5 as LowerLimit and enters 13 as UpperLimit, then BETWEEN 5 AND 13 statement works fine. If user enters 8 as LowerLimit and enters 8 as UpperLimit, I wish the statement Price BETWEEN 8 AND 8 acting same as Price = 8

    Code:
    SELECT * FROM Products
    WHERE Price BETWEEN 10 AND 10;


  2. #2
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Use >= AND <= if you're using integers. Logically, 8 is not between 8 and 8.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    between 8 and 8 will work. But why are you asking the question? it is simple enough for you to run the code you provided

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    "Is this kind of SQL DELETE statement valid?"

    Not to be picky, but what Delete Statement?

    Code:
    SELECT * FROM Products
    WHERE Price BETWEEN 10 AND 10;

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Does INTO statement delete existing table?
    By vetabz in forum Queries
    Replies: 6
    Last Post: 01-25-2017, 05:46 PM
  2. Replies: 9
    Last Post: 01-23-2017, 08:53 AM
  3. Delete fileds in tables by using sql statement
    By BorisGomel in forum Access
    Replies: 4
    Last Post: 11-14-2012, 04:38 PM
  4. Delete SQL statement not working properly
    By Alexandre Cote in forum Programming
    Replies: 3
    Last Post: 10-18-2010, 12:56 PM
  5. is this a valid SQL statement ? (simple)
    By markjkubicki in forum Queries
    Replies: 1
    Last Post: 07-22-2010, 06:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums