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

Query for top 500 donors

Status
Not open for further replies.

kpsony

Technical User
Sep 7, 2004
37
US
I need to run a query on our top 500 donors. We have 2 DB's that are connected. One called "Main DB", the 2nd called "Gifts DB" They are connected through the DonorID.

I need to do a query to find out our top 500 donors...

ANy help?
 
When you are building your query, if you go into View and Properties (in the main Access Menu bar), you can set the query to show you the top 500 records. This may work if you sort your query descending for whatever you consider the top value.

Hope this helps.
 
The problem with that is the way our Database is set up.

When someone donates more that once, it adds them into the DB as follows:
First/Last/DONORID/AMOUNT/Date
Jack/Wilson/1131/$20.00/01/03/04
Jack/Wilson/1131/$45.00/07/05/04

So, if we sort Ascending or Descending, it will bring up the person numerous times dependind on the amounts they have donated.
 
Code:
select top 500 first, last, DONORID, Sum(AMOUNT) as TotAmt
from table
group by first, last, DONORID
order by Sum(AMOUNT)

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
I'm sorry, but I am very new access, what is the code that I need to put in the SQL part?
 
You should be able to take traingamer's code as is and place it in the SQL window. Don't forget to replace "table" with the name of your table.

Collen
 
Which fields are in which table?


Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top