On 23 Apr 2019, at 3:42pm, Charles Leifer <colei...@gmail.com> wrote:

> Thanks Simon -- this is just a minimal example. The WHERE clause is needed 
> because, unless I would provide a CASE WHEN for every single (key, value), 
> then the UPDATE would set the "extra" value of any unmatched key, value to 
> NULL.

You can use ELSE:

UPDATE "bu" SET "extra" = CASE "key"||"value"
    WHEN 'k1'||1 THEN 100
    WHEN 'k2'||2 THEN -200
    WHEN 'k3'||3 THEN 30
    ELSE "extra"
END;

But I still think that using multiple UPDATE statements will still be far 
faster.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to