The problem with my SUM below is that I don't want it to sum up like amounts. For example, there may be multiple rmstranamt showing but if in the list there are 2 that are alike, just sum up one of them along with the others. In other words, I need to somehow do a grouping of the rmstranamt so that I'm not summing up one unique number twice in my SUM.
Example output. Lets say my query finds 3 rmstranamt records for a particular account. Right now it's taking 3265.12 + 3265.12 + 3000.50 which is not right. I need just 3265.12 + 3000.50 and to ignore the other duplicate 3265.12:
10 3265.12
10 3265.12
10 3000.50
Part of my SQL Statement that is selecting this:
INNER JOIN
(
SELECT RMSFILENUM,
SUM(rmstranamt) AS rmstranamt10
FROM RFINANL
WHERE RMSTRANCDE = '10'
GROUP BY RMSFILENUM
) AS rf10 ON rf10.RMSFILENUM = rm.RMSFILENUM
Example output. Lets say my query finds 3 rmstranamt records for a particular account. Right now it's taking 3265.12 + 3265.12 + 3000.50 which is not right. I need just 3265.12 + 3000.50 and to ignore the other duplicate 3265.12:
10 3265.12
10 3265.12
10 3000.50
Part of my SQL Statement that is selecting this:
INNER JOIN
(
SELECT RMSFILENUM,
SUM(rmstranamt) AS rmstranamt10
FROM RFINANL
WHERE RMSTRANCDE = '10'
GROUP BY RMSFILENUM
) AS rf10 ON rf10.RMSFILENUM = rm.RMSFILENUM