Hi guys,
I hope I can explain this issue properly.
I have a table called "Payments" and a table called "WorkOrders". The "Payments" table contains a record for each payment that is made against a Workorder ("WorkOrder" table). There may me multiple payments agains a Workorder.
A WorkOrder is the same as an invoice. Not all WorkOrders will have payments against them.
I'm creating a report that uses the following query to total up all of the payments for each Workorder and insert it into the report...I have all of this working well and I even have some other calculations as well.
My problem is that I want to display a column called "Owed" that shows how much money for each Workorder, is owing after taking into consideration all of the payments that have been made against that Workorder. I have this logic working well. The issue is when there aren't any payment records in the "Payments" table. There is no value for me to calculate. Is there a way I can set some sort of default value to be used in the event that no records are found? I would like to set the default to "0"....
Thanks for your help.
Here is the query I am using to sum the records in the "payments" table:
SELECT DISTINCTROW Payments.WorkorderID, Sum(Payments.PaymentAmount) AS [Total Payments]
FROM Payments
GROUP BY Payments.WorkorderID;
Regards
Greg
I hope I can explain this issue properly.
I have a table called "Payments" and a table called "WorkOrders". The "Payments" table contains a record for each payment that is made against a Workorder ("WorkOrder" table). There may me multiple payments agains a Workorder.
A WorkOrder is the same as an invoice. Not all WorkOrders will have payments against them.
I'm creating a report that uses the following query to total up all of the payments for each Workorder and insert it into the report...I have all of this working well and I even have some other calculations as well.
My problem is that I want to display a column called "Owed" that shows how much money for each Workorder, is owing after taking into consideration all of the payments that have been made against that Workorder. I have this logic working well. The issue is when there aren't any payment records in the "Payments" table. There is no value for me to calculate. Is there a way I can set some sort of default value to be used in the event that no records are found? I would like to set the default to "0"....
Thanks for your help.
Here is the query I am using to sum the records in the "payments" table:
SELECT DISTINCTROW Payments.WorkorderID, Sum(Payments.PaymentAmount) AS [Total Payments]
FROM Payments
GROUP BY Payments.WorkorderID;
Regards
Greg