Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Another way of coding this where-clause

I have this where clause that i needed to modify. I want to exlcude
any values 050102xxxx (the first 6 values start with 050102).

I did it by adding an "and" clause. You can see this value is in the OR clause already. Can I exlcude in the OR clause?

where  (    m.loc_id   LIKE '2001%' 
           OR m.loc_id LIKE '2002%'
           OR m.loc_id LIKE '2003%'
           OR m.loc_id LIKE '1001%'
           OR m.loc_id LIKE '1003%' 
           OR m.Loc_ID LIKE '1002%' 
           OR m.loc_id  BETWEEN '0008000000' AND '0171999999' 
           [b]OR m.Loc_ID BETWEEN '0501000000' AND '0501999999'  [/b]          
          )   [b]and m.loc_id not like '050102%'[/b] 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Ashcraft
Chris Ashcraft
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That is pretty OK, it has to be on an AND condition outside the parenthesis as you put it.
Should be fine