Reputation: 1561
I am trying to filter one of columns that has DB nulls. I am trying to see how could I merge the below 2 conditions in the where clause (checking for the column labelled type) as one condition.
select * from table
where type in ('Type_1','Type_4') or type is null
Upvotes: 0
Views: 558
Reputation: 4208
you can think about the value that you definitely won't see in the column, like "undefined" or "not specified" and use that value in coalesce
function like this:
coalesce(type,'not specified') in ('Type_1','Type_4','not specified')
but honestly I don't see a reason in doing that - just syntactic sugar at cost of a tiny performance hit
Upvotes: 2