I have developed a query, and in the results for the first three columns I get NULL. How can I replace it with 0?
NULL
0
Select c.rund
With coalesce:
coalesce
coalesce(column_name,0)
Although, where summing when condition then 1, you could just as easily change sum to count - eg:
when condition then 1
sum
count
count(case when c.runstatus = 'Succeeded' then 1 end) as Succeeded,
(Count(null) returns 0, while sum(null) returns null.)
Count(null)
sum(null)