I've never learned much SQL and I'm having some difficulty gathering the data I need for an important report.
The problem seems to be that I have two sum()s on the same field based on if another field is True or false.
I can get one value but not the other in one query.
Plus if I get the second value in a second query, I don't know how to get all the values into one table for my report.
Frankly at this point I don't care HOW my app gets the data as long as it gets to the report.
Here is a query that gets one of the Sum()s:
Now I need "SUM(GiveFundSplit."Amount") WHERE (GiveFundSplit."TaxDeductable" = 'True')
Please, ANY solution will be appreciated.
Thanks!
Tim
tim@tgm.org
The problem seems to be that I have two sum()s on the same field based on if another field is True or false.
I can get one value but not the other in one query.
Plus if I get the second value in a second query, I don't know how to get all the values into one table for my report.
Frankly at this point I don't care HOW my app gets the data as long as it gets to the report.
Here is a query that gets one of the Sum()s:
Code:
SELECT Customers."CustomerID", SUM(GiveFundSplit."Amount") AS NonDeductable
FROM "Customers.DB" Customers
INNER JOIN "GiveDonations.DB" GiveDonations
ON (Customers."CustomerID" = GiveDonations."DonorID")
INNER JOIN "GiveFundSplit.DB" GiveFundSplit
ON (GiveDonations."DonationID" = GiveFundSplit."ContributionID")
WHERE (GiveFundSplit."TaxDeductable" = 'False') AND (GiveDonations."DonationDate" BETWEEN '01/01/2004' AND '12/31/2004') AND GiveDonations."DonationAmount" > '10.00'
GROUP BY Customers."CustomerID", Customers."Name", Customers."Street", Customers."Suburb", Customers."City", Customers."ZipCode", Customers."State", Customers."Country"
Now I need "SUM(GiveFundSplit."Amount") WHERE (GiveFundSplit."TaxDeductable" = 'True')
Please, ANY solution will be appreciated.
Thanks!
Tim
tim@tgm.org