I am trying to do a query, help

I am trying to do a query that if a column say column A = 2 and column B =0, omit them from the query.  Hod do I do this?
VBBRettAsked:
Who is Participating?
 
sdstuberCommented:
select * from your_table
where not (columnA=2 and columnB=0)
0
 
sdstuberCommented:
or...

select * from your_table
where columnA != 2 or columnB != 0

0
 
sdstuberCommented:
note, if you have NULLs in either of those columns you might not get the results you are expecting.

if you don't have NULLs then no problem.
if you do, then please specify what action you would like to take when A or B or both are NULL
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
ralmadaCommented:

In SQL Server:
 
select * from yourtable where columnA = 2 and ColumnB = 0
0
 
sdstuberCommented:
ralmada, I think you're missing some "NOT"s  

asker wanted to OMIT the 2 and 0 records.  See posts above.

Unless I'm misunderstanding the request
0
 
ralmadaCommented:
sorry I meant
In SQL Server:

select * from yourtable where columnA <> 2 and ColumnB <> 0
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.