I am stuck with a simple query. What i want is to get all rows except one Kindly have a look at the following data.
COL_A   COL_B
B       D
B       (null)
B       C
G       D
G       (null)
G       C
I want to get all rows except but B C. Kindly have a look at the sqlfiddle
I have tried to get the rows by anding col_A <> 'B' and col_B <> 'C' but it's not anding the operation. Your help will be much appreciated.
Thanks
One possible solution. Maybe not the most elegant:
select req_for col_A, doc_typ col_B 
from a
where (req_for IS NULL OR doc_typ IS NULL) 
OR (req_for,doc_typ) 
NOT IN (select 'B','C' from dual);
                        Try
where not(col_A = 'B' and col_B = 'C')
or
where col_A <> 'B' or col_B <> 'C'
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With