Consider having the ff. table (#temp_table)
| id | column1 | column2 |
|---|---|---|
| 1 | value1 | mark |
| 2 | value2 | jim |
| 3 | value3 | taylor |
| 4 | value4 | tess |
| 5 | value5 | mark |
| 6 | value6 | jim |
How do I make a select query where first, I will exclude all rows where column2 = mark then exclude all rows where column2 = jim and column1 = value2
The expected result set should be
| id | column1 | column2 |
|---|---|---|
| 3 | value3 | taylor |
| 4 | value4 | tess |
| 6 | value6 | jim |
The query I have tried so far is
select * from #temp_table where column2 != 'mark' and (column2 !='jim' and column1 != 'value2') The result of my query
| id | column1 | column2 |
|---|---|---|
| 3 | value3 | taylor |
| 4 | value4 | tess |
!=--><>........column2 <> 'mark' AND NOT (column2 ='jim' and column1 = 'value2')