We help IT Professionals succeed at work.

sql query - not contain

436 Views
Last Modified: 2014-08-16
I want to query and get only itemno that does not starts with '*' (like *100037-000), and RCD  not 'y'  . This column is char(25).  It still return * itemno in front.
     
     SELECT ITEMNO FROM table_1 WHERE rcd not like ('*%') or rcd is not null or rcd <> 'n'
     
     select distinct(rcd) from tables_1
     results : Y, N, NULL
Comment
Watch Question

AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009

Commented:
you need a 'AND' instead of OR.
IT Supervisor
CERTIFIED EXPERT
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.