Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL for monthly report with each month must be selected even if there is no data

 
manoj r patil
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one requirement: I want to generate a monthly report for a period but the catch is that each month must be selected. So if the period is say 12 months, it must return 12 rows no matter whether data is there or not for those months.

I have given the sample which I am using currently but I need to mold it to satisfy the above requirement.



Any idea how can we write this SQL?
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to have a left outer join with a table that contains all the months.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic