Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    139

    Unanswered: Simple Where clause

    This where clause basically works:

    WHERE
    code = 'creq' AND
    lsstv NOT BETWEEN 1 AND 80 OR
    code = 'nreq' AND
    lsstv NOT BETWEEN 1 AND 90

    but what I'm really trying to do in words, in the first instance above is:

    where the code = treq and lsstv = 0 or lsstv > 80...but the "code" column should only = creq. Obviously the 2nd "Or" in the previous sentence will include other values from the "code" column.
    Thanks,
    Bill

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Not clear what you are trying to do, but you can use parenthesis to define the order of precedence in your clause, like this:
    Code:
    WHERE	(code = 'creq'
    	AND lsstv NOT BETWEEN 1 AND 80)
    	OR (code = 'nreq'
    	AND lsstv NOT BETWEEN 1 AND 90)
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •