I have a query that needs to return data for all days between a given date range. The query needs to return a value of 0 for a date even if there is no data.
Example:
DATE Empid AMOUNT
20-Jun 10 200
20-Jun 11 300
24-Jun 5 150
25-Jun 17 300
25-Jun 18 200
Using this query:
SELECT DATE, SUM(AMOUNT)
From Table A
Where Date between (:FromDate) and (:ToDate)
Group by Date
**Input dates are**: 20-Jun-14 and 25-Jun-14
Result:
DATE AMOUNT
20-Jun 500
24-Jun 150
25-Jun 500
What I'm really after:
DATE AMOUNT
20-Jun 500
21-Jun 0
22-Jun 0
23-Jun 0
24-Jun 150
25-Jun 500
Is there a way possible to achieve this?
Thanks!