|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > sql newbee needs help with query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|