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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Totals Query

Status
Not open for further replies.

Buddha1

Technical User
Feb 5, 2004
32
US
I have a query that is totaling the dollar amounts based on the type of credit card. I have a patient that was entered twice in the database because they paid on two different balances with a mastercard. When I run the query this particualr patients dollar amounts are twice the amount they should be. The patient is only in the database twice however the results are 190.08 when the total should be 95.04.
 
Can you post your code?

In the meanwhile for kicks try inserting distinct in your SQL.

Select distinct...

Hope this helps.
 
SELECT DISTINCT TblSitePaymentInfo.Location AS Expr1, TblMain.Date, TblSitePaymentInfo.TypeOfCard, Sum(TblMain.Payment) AS SumOfPayment
FROM TblMain INNER JOIN TblSitePaymentInfo ON TblMain.[Acct #] = TblSitePaymentInfo.CreditCardNumber
GROUP BY TblMain.Date, TblSitePaymentInfo.TypeOfCard, TblSitePaymentInfo.Location
HAVING (((TblMain.Date)=#2/5/2004#) AND ((TblSitePaymentInfo.Location)="Per-Se"));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top