If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Query is driving me nuts!! - Subtraction problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-09-06, 19:38
waynegretzky waynegretzky is offline
Registered User
 
Join Date: Jan 2006
Posts: 2
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)
Reply With Quote
  #2 (permalink)  
Old 01-10-06, 06:16
ivon ivon is offline
Registered User
 
Join Date: Nov 2002
Posts: 272
Quote:
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?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On