Reputation: 840
I have this strange requirement to pass 'NULL' and "" values from database which should be either '=' or 'IN' Operator.
I have written the query but seems like it's not working.
select * from bookDetails where RBN in ("",null);
Thank you
Upvotes: 0
Views: 75
Reputation: 865
we can't use null in IN.
select * from bookDetails where RBN = '' OR RBN IS NULL
Upvotes: 0
Reputation: 51
Please use below query to get expected results
Select * From bookDetails Where RBN = '' OR RBN IS NULL
Upvotes: 0
Reputation: 28834
NULL
is a special value, and it has to be handled separately using IS NULL
operator, and cant be used in the IN
operator:
select * from bookDetails
where RBN = ''
OR RBN IS NULL
Upvotes: 2