Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 9th, 2005, 11:47 AM
dlorimer dlorimer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 3 dlorimer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 29 sec
Reputation Power: 0
sql newbee needs help with query

Hi,

I'm new to sql and am working on a contact management program. One of the functionalities of this program is that the user can make queries based on user defined criteria (kind of like Lotus Approach). I need to incorporate the following into the criteria that users can select.

I have two database tables:

Contact
Donations

Contact contains our contacts (people).
Donations contains any donations those people may have given.


So, say Joe Blow (contact) has given 5 donations in the past year, $5, $50, $10, $100, $25 -- the total being $190.

Each donation is a separate record and the field that contains the amount for each donation is called "donation_amount".

Now, I need to be able to query with the total donation amount of one contact as one of the criteria.

For example:

The user of this program wants to know all the contacts who have given a total of at least $150 in the past year.

How do I do that? I know how to do everything except the total of donations. And not only do I have to be able to do it, it has to be dynamic somehow.

Can anyone help me with this?

If I need to explain more, let me know.

Thanks,
Daniel Lorimer

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > sql newbee needs help with query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT