When I run the following query, I get a sum of amount per accounting period. However in some accounting periods, I do not have any amount, so naturally, those periods with no sum of amount (null) are not shown in the result set.
I would like to know how to return those with the sum of amount 0 for them.
SELECT
ACCOUNTING_PERIOD,
SUM(RESOURCE_AMOUNT) AS TOTAL,
FROM
RESOURCE_TBL
GROUP BY
ACCOUNTING_PERIOD
I get the following result set
accounting_period TOTAL
-------------------------
1 234
3 65
5 943
6 299
. .
. .
. .
In the above period 2 and 4 is left out since the sum is zero or null but I would like to get
accounting_period TOTAL
-------------------------
1 234
2 0
3 65
4 0
5 943
6 299
. .
. .
. .