Subject Re: [firebird-support] Unexpected behavior in subquery
Author Dmitry Yemanov
Alex Castillo wrote:
>
> I've been using Fb 2.0.1 and now 2.1 and I got an unexpected behavior in the
> next queries:
>
> 1.-
> SELECT FOLIOVENTA FROM VENTAMOSTRADOR
> RESULT 822 ROWS (CORRECT)
>
> 2.-
> SELECT FOLIOVENTA FROM CONTRATOTARIFARIO WHERE FOLIOVENTA IS NOT NULL
> RESULT 107 ROWS (CORRECT)
>
> 3.- *********** unexpected ***************
> SELECT folioventa from VENTAMOSTRADOR WHERE
> folioventa not in (SELECT folioventa from CONTRATOTARIFARIO)
> 0 ROWS (WRONG !!!!!!!!!! )

Please read the SQL standard. If subquery contains any NULL value
within, then the result of the NOT IN predicate is false. If you don't
need this behaviour, use NOT EXISTS instead.


Dmitry