Thanks for any help, I think I am thinking myself into a corner...
In my database I have (among others) 2 tables. One is a list of people who owe money (debtors) and the other is a list of individual debts. A debtor can have one or more debts. Debts are assigned a 3 digit status code.
What I need to output is a list which contains the debtor ID number, the debtor name, and the sum of his debts which have a status code less than 400 - or put another way, I need debts whose status is greater than or equal to 400 to be excluded from the sum.
Complicating this, I also need to be able filter the results by an arbitrary balance total.
So, in English, something like this:
select the debtor ID, debtor name, and a sum of debt balances where debt status is less than 400 and the sum of the balances for those debts is greater than $300.
What is really hanging me up is that last part. It seems like I need to do a subquery to get the value to compare, but I just can't wrap my mind around what it should look like.
Thanks again,
JAFrank
In my database I have (among others) 2 tables. One is a list of people who owe money (debtors) and the other is a list of individual debts. A debtor can have one or more debts. Debts are assigned a 3 digit status code.
What I need to output is a list which contains the debtor ID number, the debtor name, and the sum of his debts which have a status code less than 400 - or put another way, I need debts whose status is greater than or equal to 400 to be excluded from the sum.
Complicating this, I also need to be able filter the results by an arbitrary balance total.
So, in English, something like this:
select the debtor ID, debtor name, and a sum of debt balances where debt status is less than 400 and the sum of the balances for those debts is greater than $300.
What is really hanging me up is that last part. It seems like I need to do a subquery to get the value to compare, but I just can't wrap my mind around what it should look like.
Thanks again,
JAFrank