SELECT IsNull(IP.CarrierBalance,0) as CarrierBalance, IsNull(SP.NoCarrierBalance,0) as NoCarrierBalance
FROM ChargeDetails CD
LEFT OUTER JOIN (
SELECT CD.InvoiceNum, SUM(CD.TotalFee)-(ISNULL(SUM(P.PaymentAmt),0)) AS NoCarrierBalance
FROM ChargeDetails CD
INNER JOIN Payments P ON CD.ChgDetID = P.ChgDetID
WHERE CD.CarrierID IS NULL
GROUP...