Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to sum two fields from different tables

Status
Not open for further replies.

bmoberly8888

Technical User
Nov 18, 2004
26
US
I have two tables - cash and trust - I need to be able to add the cash amount to the trust amount to get one total.
I also have a prompt for a date range so users can enter a date range and see their cash receipts. I keep getting an error when I try to run it. The Cash report runs fine on its own and the trust runs fine on its own - but I am having a problem getting the final result. Here is the code I have:

SUM (CASE WHEN ([cash].[date] BETWEEN ‘@@Prompt:begdate:data:Enter beg date:mad:@' AND ‘@@Prompt:enddate:data:Enter end date:mad:@') OR ([trust].[date] BETWEEN '@@Prompt:begdate:data:Enter beg date:mad:@' AND '@@Prompt:enddate:data:Enter end date:mad:@') THEN (ISNULL ([trust].[TrustAmt], 0 ) + ISNULL ( CONVERT (money, [cash].[Cash]), 0) ELSE 0 END)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top