I have this query
SELECT
LineId, [LineNumber],
TotalNeed, TotalMRC, TotalMIV, TotalIMIV,
(TotalMRC - TotalMIV) as Shortage
FROM
(SELECT
LineId,[LineNumber],
ROUND(SUM(Quantity), 3) AS TotalNeed,
SPMS2.dbo.ReturnTotalMRCByLineId(LineId) AS TotalMRC,
SPMS2.dbo.ReturnTotalMIVByLineId(LineId) AS TotalMIV,
SPMS2.dbo.ReturnTotalIMIVByLineId(LineId) AS TotalIMIV
FROM
[SPMS2].[dbo].[ViewMTO]
GROUP BY
lineid, [LineNumber]) a
And these are the results :
As you can see some of my columns value are null. How can I set it to 0 if the value of that is null?

COALESCE().