August 15, 2011 at 9:01 pm
So, you only want to exclude rows where varA = 1 and varB = 'Green'.
WHERE NOT (varA = 1 AND varB = 'Green')
Assuming that varA and varB are actually columns here. If they are actually variables, then you will either get all rows - or none, depending on the values in the variables.
If your requirements are to include all rows where varA = 1 and varB = 'Green', but only when they are not on the same row:
WHERE (varA = 1 AND varB <> 'Green')
OR (varA <> 1 AND varB = 'Green')
Or - this should work, but test it...
WHERE (varA = 1 OR varB = 'Green')
AND NOT (varA = 1 AND varB = 'Green')
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
August 16, 2011 at 9:00 am
Yes.
WHERE NOT (varA = 1 AND varB = 'Green') is exactly what I was looking for.
I knew it was something really simple. It was driving me nuts that I couldn't think of it. Thank you!
Viewing 2 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply