Reputation: 110163
Is there a way to do the following without a CASE
statement?
SELECT ifnotnull(field1, '!!!')
Now I'm currently doing the verbose:
CASE WHEN field1 IS NOT NULL THEN '!!!' ELSE field1 END
Upvotes: 4
Views: 10532
Reputation: 6836
yes:
SELECT if(field1 is not null, '!!!', field1)
which would be the same as
SELECT if(field1 is not null, '!!!', NULL)
Documentation on IF
is here.
Upvotes: 10