Skip to content
Advertisement

Oracle SQL – Sum and group data by daily, weekly and monthly. (With missing date, week, and month)

I need to get total amount of transactions group by daily, weekly and monthly. What i’ve tried gave me the result I expected but not giving the date or week or month if there is no transactions on the particular period.

For an example: Monthly result

But i need the result like :

Advertisement

Answer

You need to generate all dates between your start and end date and join it with the result of your query.

Following query will give daily total amount. You need to change group by, order by and select clause if you want to get weekly and monthly result.

Cheers!!

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement