# Thread: Query is driving me nuts!! - Subtraction problem

1. Registered User
Join Date
Jan 2006
Posts
2

## Unanswered: Query is driving me nuts!! - Subtraction problem

(rf.rmstranamt) - (select rf.rmstranamt FROM RMASTER rm
INNER JOIN RFINANL rff ON rff.RMSFILENUM = rm.RMSFILENUM
where rff.RMSTRANCDE = '10') AS [Current Balance],
FROM RMASTER rm
INNER JOIN RFINANL rf ON rf.RMSFILENUM = rm.RMSFILENUM
GROUP BY rm.rmsacctnum

something wrong with how I'm trying to calculate the subtraction here. I'm not sure the syntaxt to include the divisor in this particular situation. I need to subtract from the rmstranamt where rmstrancde is 10 and there should only be one results for the divisor

This is what I need in my results:

Current Balance and Account Number should be retrieved where

Current Balance = Sum of rmstranamt - (sum of rmstranamt where rmstrancde is 10)

2. Registered User
Join Date
Nov 2002
Posts
272
Originally Posted by waynegretzky
Current Balance = Sum of rmstranamt - (sum of rmstranamt where rmstrancde is 10)
Is that equivalent to
Current Balance = (sum of rmstranamt where rmstrancde <> 10)
? If so, would that make your query less complicated?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•