alc4emy5t, if you need only records from table CreditNote related to one Invoice you need execute following query:
Select SUM(MonthCharge), SUM(TotalCharge)
From Invoice RIGHT JOIN CreditNote ON InvoiceRef = InvoiceNo
where Invoice.CustID = 'wnet10692';
I hope this query pull out information that you need.
Main Topics
Browse All Topics





by: BlackTigerXPosted on 2005-02-23 at 20:30:24ID: 13389671
>>I basically want to subtract the MonthCharge From the SUM of the TotalCharge to get how much we actually charged the customer.
Charge)
if your query is working (and I understand what you need) then this should do the job:
Select SUM(MonthCharge), SUM(TotalCharge), sum(TotalCharge)-sum(Month
From Invoice LEFT OUTER JOIN CreditNote ON InvoiceRef = InvoiceNo
where Invoice.CustID = 'wnet10692'