I have a table as below:
Original table
I want to use SQL to filter out any records Type= 'B' or any records ID=1 or any records Color='red'.
I can filter out step by step.
Could I do it once.
I tried the Where Type <> 'B' OR ID <> 1 OR Color <> 'red'
in SQL Server. But it doesn't work. Could someone help?
Thanks!
The expected result should be:
CodePudding user response:
What you are saying, in SQL:
...
WHERE
NOT (TYPE='B'
OR ID=1
OR Color='red')
or, applying the OR operator to the parenthesised section:
...
WHERE
TYPE<>'B'
AND ID<>1
AND Color<>'red'