12,078,795 members (47,237 online)
Rate this:
See more:
hello,

in my application i wanted to store donor details ,so i have created a donor table with some field like donor name, amount etc.. same donor can donate amounts any time. so i wanted to get the total amounts donated by each donors is there any way?

Thanks
Ginnas
Posted 27-Mar-13 22:54pm
ginnas462
Edited 27-Mar-13 22:55pm
v2

Rate this:

## Solution 1

You need the `SUM` function and a `GROUP BY` clause.
Something like
```SELECT donor, SUM(donation) as TotalAmount
From MyTable
Group By donor```
ginnas 28-Mar-13 5:25am

Thanks Hiller
it helped me truely, thank you very much
i have few more doubts,in the same table i have to get 1-the donors who donating more than 10000 in year
2-donors who are not donating during the past 2 years
in my table i have one field for storing the donating date

so how can we do this ?

Regards
Ginnas
Rate this:

## Solution 2

Well, you need to use the aggregate function to get the total amount.
And you need to use the Group by clause to group the total amount from each donor.

`select donor, sum(amount) from tbl_x group by donor`

that's all.
I hope this helps you.

Top Experts
Last 24hrsThis month
 Dave Kreskowiak 715 CHill60 400 Richard MacCutchan 345 ppolymorphe 325 CPallini 275
 Dave Kreskowiak 3,551 OriginalGriff 3,120 Richard MacCutchan 2,624 CPallini 1,907 CHill60 1,779