testing inequality with columns that can be null

后端 未结 8 1146
不思量自难忘°
不思量自难忘° 2021-02-05 14:48

So, I asked a question this morning, which I did not phrase correctly, so I got a lot of responses as to why NULL compared to anything will give NULL/FALSE.

My actual q

8条回答
  •  北荒
    北荒 (楼主)
    2021-02-05 15:31

    can you try something like this in informix?

    CASE
        WHEN a IS NULL AND B IS NULL THEN false 
        WHEN a IS NULL OR B IS NULL THEN true
        ELSE a <> B
    END
    

    from IBM Informix Guide to SQL: Syntax , CASE Expressions

提交回复
热议问题