MySQL Forums
Forum List  »  Oracle

how to get missing year and months
Posted by: rajesh yadav
Date: July 26, 2014 01:45AM


I have to get count of each month of each year using SP

the parameters are date range , it can be more than one year.

the problem is, in database there is data for few months only , but user can enter a big date range.

and i have show each month's count, if it does not exits then each month should show 0.

one approach was to get the count existing data for each year-month in a temp table, then loop through to insert missing year-month and finally select them.

second approach was to create temp table of year-month which is passed from parameter, buy subtracting two dates. then use left join to get the above result.

please suggest if there is any other way to accomplish the task?

yours sincerely

Options: ReplyQuote

Written By
how to get missing year and months
July 26, 2014 01:45AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.