dimanche 30 novembre 2014

The Null Value -- different results in Sql syntaxes


Vote count:

0




I have 2 different queries (with different purposes) working perfectly but there is something I can not grasp yet about the Null value


Here is one query:



select NCLI , LOCALITE , CAT
from CLIENT
where CAT not in (’B1’,’C1’)
or LOCALITE not in (’Lille’,’Namur’);


It shows exactly what I want Including the rows where CAT has a null value. Now this seems perfectly logical to me.


The only thing that disturbs me is that the query below only worked when I specified I did wanted the null rows in CAT to show up


 select NCLI , LOCALITE , CAT from CLIENT where CAT <> ’C1’ or CAT is null or LOCALITE = ’Namur’;


When I don't add -- or CAT is null -- the null values don't show up. Could someone tell me what I'm not grasping here yet? Thanks.



asked 16 secs ago







The Null Value -- different results in Sql syntaxes

Aucun commentaire:

Enregistrer un commentaire