Can't you just use IFNULL to assign a default value?
CASE IFNULL( x, -999 )
WHEN 1 THEN 11
WHEN 2 THEN 22
WHEN 3 THEN 33
WHEN 4 THEN 44
WHEN -999 THEN 55
ELSE 66
END
On 5 July 2018 at 11:35, R Smith wrote:
> On 2018/07/05 8:44 AM, Simon Slavin wrote:
>
>> On 5 Jul 2018, at 7:30am, C
On 2018/07/05 8:44 AM, Simon Slavin wrote:
On 5 Jul 2018, at 7:30am, Clemens Ladisch wrote:
The expression "x = x" will fail for NULL, but succeed for everything
else. So you can use that to implement a "not-NULL ELSE"
Wow. That has to be the most counter-intuitive feature of SQLite. I
un
On Thursday, 5 July, 2018 00:57, Donald Shepherd :
>On Thu, 5 Jul 2018 at 16:45, Simon Slavin >wrote:
>> On 5 Jul 2018, at 7:30am, Clemens Ladisch >wrote:
>>> The expression "x = x" will fail for NULL, but succeed for
>>> everything else. So you can use that to implement a
>>> "not-NULL ELSE"
On Thu, 5 Jul 2018 at 16:45, Simon Slavin wrote:
> On 5 Jul 2018, at 7:30am, Clemens Ladisch wrote:
>
> > The expression "x = x" will fail for NULL, but succeed for everything
> > else. So you can use that to implement a "not-NULL ELSE"
>
> Wow. That has to be the most counter-intuitive featur
On 5 Jul 2018, at 7:30am, Clemens Ladisch wrote:
> The expression "x = x" will fail for NULL, but succeed for everything
> else. So you can use that to implement a "not-NULL ELSE"
Wow. That has to be the most counter-intuitive feature of SQLite. I
understand why it works, but I still don't l
Andy Goth wrote:
> The expression "x = NULL" is meaningless since it will always evaluate
> to NULL, which CASE interprets as untruth, hence "WHEN NULL THEN" will
> never accomplish anything.
> [...]
> So I'm wondering: can we do better?
The expression "x = x" will fail for NULL, but succeed for e
On 5 Jul 2018, at 6:22am, Andy Goth wrote:
> Or equivalently, "ISNULL" instead of "IS NULL".
There is no ISNULL in sqlite3. Also, the functions ifnull() and nullif() are
not useful for actually testing for NULL. Continuing to eliminate options,
regular expressions do not match with NULL in a
I'd like to use CASE to compare an expression x against a number of
candidate values. That's the typical use for "CASE x WHEN", which
avoids repeating x for each condition.
The trouble is that one of the possible values is NULL, yet the
comparison against each candidate value is done with the
8 matches
Mail list logo