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

Based on criteria don't show record

Status
Not open for further replies.

hunter517

Programmer
Jan 28, 2004
1
US
I have a SQL table that stores fees. I am using this table to write a Crystal Report. Two fields in this table are pcf_amt_due and pcf_amt_pd.

If someone has paid their fee a record is created and pcf_amt_pd shows 9.00. If someone is refunded another record is created and this same field shows -9.00. (Same table.)

How can I create a view of this table in SQL so that if there has been a refund record then the record showing the amount paid will not show either. In other words, I don't want to see either record if there has been a refund.

Any help is appreciated.
 
Try:

select someone, sum(pcf_amt_due) as TotalOrigDue, sum(pcf_amt_pd) as TotalPaid, sum(pcf_amt_due) - sum(pcf_amt_pd) as TotalDue
from TheTable group
by someone
having (sum(pcf_amt_due) - sum(pcf_amt_pd)) > 0
 
Does this table have a parent table somewhere so that you can see the realtionship between the two records?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top