Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > SQL Select All ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 11026 of 11262
Post > Topic >>

SQL Select All Items where one meets the criteria

by ckauvar@[EMAIL PROTECTED] May 8, 2008 at 09:05 AM

I've got a SQL statement that has me stumped.  Consider the following
scenario:

A donor gives the following gifts:
in 2006 they give $250
in 2007 they give $550
in 2008 they give $50

My re****t needs to select this individual because any one of their
gifts exceeded $500 and then it needs to print all of their gifts in
every year since 2006.  Even though the other 2 gifts don't meet the
over $500 criteria, they need to appear on the re****t since the
individual has one gift that exceeds $500.

I've got the following so far:
select people.people_code_id, givingsummary.giving_amount,
givingsummary.fiscal_year from
people, givingsummary
where people.people_code_id = givingsummary.people_org_code_id and
givingsummary.giving_amount in (select giving_amount from
givingsummary where giving_amount>=500 and
fiscal_year<>'')

My problem is that the query is excluding gifts less than $500, so
they aren't printing on my re****t for people who have given one gift
that was over $500.  How do I tell SQL to print all gifts within a
specific timeframe if one of the gifts exceeds $500?

Thanks in advance!
 




 4 Posts in Topic:
SQL Select All Items where one meets the criteria
ckauvar@[EMAIL PROTECTED]  2008-05-08 09:05:55 
Re: SQL Select All Items where one meets the criteria
"Plamen Ratchev"  2008-05-08 13:20:44 
Re: SQL Select All Items where one meets the criteria
ckauvar@[EMAIL PROTECTED]  2008-05-08 11:17:34 
Re: SQL Select All Items where one meets the criteria
"Plamen Ratchev"  2008-05-08 16:24:35 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 5:39:27 CDT 2008.