With coalesce
:
coalesce(column_name,0)
Although, where summing when condition then 1
, you could just as easily change sum
to count
- eg:
count(case when c.runstatus = 'Succeeded' then 1 end) as Succeeded,
(Count(null)
returns 0, while sum(null)
returns null.)