AnsweredAssumed Answered

<> and null values in eSQL

Question asked by davehob on Aug 20, 2014
Latest reply on Aug 20, 2014 by davehob

RSC::isDoubleBookable can be set to 1 or [null] (to indicate whether or not a resource is double-bookable).

 

ExecuteSQL("
SELECT r.id
FROM RSC r
WHERE r.isDoubleBookable = ?
"; "" ; "";"1")

... works fine - returns the records where the indicator is set.

 

ExecuteSQL("
SELECT r.id
FROM RSC r
WHERE r.isDoubleBookable <> ?
"; "" ; "";"1")

... does not – returns nothing.

 

But:

 

ExecuteSQL("
SELECT r.id
FROM RSC r
WHERE r.isDoubleBookable IS NULL
"; "" ; "")

returns the records where the indicator is not set.

 

I would have expected the “<>” operator to return the records where the indicator does not equal “1”, but I’ve obviously misunderstood. Can someone enlighten me, in case my lack of understanding trips me up in future?

 

Thanks,

Dave.

Outcomes