Select case Then Null

Hello,

I have a case statement in a select statement and I want it to return null when the value is 0. For example -

case when capacity = '0' then '' else capacity end as 'capacity',

  • still gives me a 0 in the results.

case when capacity = 0 then null else capacity end as capacity

So easy :slight_smile: Thank you!

1 Like

or:
NULLIF(capacity, 0) AS capacity

1 Like