I have created a query from two tables with the following SQL statement
I would like to query that query to return every category and sum amount values that occur Year-to-date, and there is no transaction year-to-date, it returns a $0.00 for the amount. I think I need the Nz function, but I'm not doing something right because I can sum those Amounts, but not return the $0.00 value when that transaction has not occurred yet this year:
Thank you for your help.
SELECT Transactions.ID, Transactions.CheckDate, Transactions.TransactionDescription, Transactions.Category, Transactions.Amount, Transactions.Cleared, Transactions.CheckNumber, Transactions.Memo, Categories.[Income/Expense]
FROM Categories INNER JOIN Transactions ON Categories.Catagory_ID = Transactions.Category
WHERE (((Categories.[Income/Expense])="Expense"));
I would like to query that query to return every category and sum amount values that occur Year-to-date, and there is no transaction year-to-date, it returns a $0.00 for the amount. I think I need the Nz function, but I'm not doing something right because I can sum those Amounts, but not return the $0.00 value when that transaction has not occurred yet this year:
SELECT DISTINCT Expenses.Category, Year([CheckDate]) AS [Year], Nz(Sum([Amount]),0) AS Total
FROM Expenses
GROUP BY Expenses.Category, Year([CheckDate])
HAVING (((Year([CheckDate]))=Year(Date())));
Thank you for your help.