Select on a date and the return can not be null

0

I need the return of a date, if it is "Null" in the DB, return another date or other than "Null."

    
asked by anonymous 17.01.2018 / 11:44

3 answers

0

Assign the IS NOT NULL as it will filter all non-NULL values.

SELECT * FROM Table WHERE DataInicio IS NOT NULL
    
17.01.2018 / 11:57
1

Try this:

select case
         when campo_que_pode_estar_null is null then 'valor retornado se estiver null'
       else
         campo_que_pode_estar_null
       end 
from tabela

With this, even if the field is null, it will return something.

    
17.01.2018 / 11:59
-1

I forgot to mention that the database was Firebird.

But I found a solution, I used coalesce('nomedacoluna',0 ou'') as 'nomedacoluna'

    
17.01.2018 / 18:18