total donations, then add variable

SDLevy

Registered User.
Local time
Yesterday, 17:58
Joined
Jul 1, 2002
Messages
14
Hello,

I've puzzled with this for a few days and looked it up on the Web and in a couple of books and still can't find the solution.

I have a People table and Event table. They are a M:M so I have a PeopleEvent table that I am able to put in attendance and donation amount for each person and for each event they attend. Some people attend many events and make many donations.

I was able to create a report that gave me their total donations, but now I want to be able to find everyone whose total is over a certain amount.

I can't figure out how to add this variable.

Thanks,

Susan

in balmy Alaska
 
select P.people, sum(D.donations) as totalamt
from people as P
inner join PeopleDonation as PD on P.PID = PD.PID
inner join Donation as D on D.DID = PD.DID
where D.donations > 0
group by P.people
having sum(D.donations) > 10000

Or something close to that, since it is off the top of my head it is possible I made a syntax error in that, but it gives you the idea.
 

Users who are viewing this thread

Back
Top Bottom