is its somehow possible to do a select for empty strings and NULL values in Mysql without using or?
this:
select * from table where col IN (null, "");
doesnt work, it ignores the null (or possibly matches it with the string 'null'
thanks, P.V. Goddijn
Note, however, than
OR
query will be much more efficient if the column is indexed:This will use
ref_or_null
access path on the index.If you need to select from a list of values along with
NULLs
, just put all not-null values into the list and add a singleOR IS NULL
condition:This will use an index on
col
as well.