I want to add two numbers together but when one of those numbers is null then the result is null. Is there a way around this. I could simply do it in the code but I would rather have it done in the query. This is a oracle database.
The table structure
hours_t
type craft regular overtime
A 1 5 0
A 1 3 1
B 2 9 <null>
B 1 4 4
The query
select type, craft, sum(regular + overtime) as total_hours
from hours_t
group by type, craft
order by type, craft
The unwanted results
type craft total_hours
A 1 9
B 1 8
B 2 <null>
The wanted results
type craft total_hours
A 1 9
B 1 8
B 2 9