If I want to add total payments and total adjustments into one column per unique source ID, how would you do this? This is what I am doing and it isn't totaling correctly.
Total Payments = 102.02
Total Adjustments = 76.06
This data is listed in two different rows with the same source ID....
I wrote this but it isn't totaling correctly:
SET SOS_Transactions.total_paidoncharge = b.total_paidoncharge
FROM SOS_Transactions a JOIN
(SELECT DISTINCT practice_id, source_id, SUM (ISNULL(total_payments,0) + ISNULL(total_adjustments, 0)) AS [total_paidoncharge]
FROM SOS_Transactions b Group by practice_id, source_id) b ON a.practice_id = b.practice_id and a.source_id = b.source_id