After conducting a left join, I was left with many null (empty) values. How may I replace those null values with a 0 in only certain columns within the same query?
select
m1.*, t2.Apple, t3.Berry, t4.Cherry
from
table1 as t1
left join table2 as t2 on t1.id = t2.id
left join table3 as t3 on t1.id = t3.id
left join table3 as t4 on t1.id = t4.id
;
Example Output
ID Apple Berry Cheery
1 1 NULL 1
2 1 NULL NULL
3 NULL 1 NULL
4 NULL NULL NULL