Subject Re: [firebird-support] how NULL compares
Author Ivan Prenosil
> I have a table like
>
> ID INTEGER
> TIMEIN TIME
> TIMEOUT TIME
>
> populates with records like
> 1 Time1 <Null>
> 2 <Null> Time2
> 3 Time3 <Null>
> 4 <Null> Time4 etc.
>
> If i use
>
> SELECT *
> WHERE (TIMEIN > Param1) AND (TIMEIN < Param2) AND (TIMEOUT > Param1)
> AND (TIMEOUT < Param2)
>
> will it return the right records and NULL is not being compared here?

No, you have to test for nulls explicitely

WHERE (TIMEIN > Param1 OR Param1 IS NULL) AND ...

Ivan