aspose file tools
The moose likes JDBC and the fly likes SQL for monthly report with each month must be selected even if there is no data Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "SQL for monthly report with each month must be selected even if there is no data" Watch "SQL for monthly report with each month must be selected even if there is no data" New topic
Author

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

manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 180
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?


love your job and not your company;
...because you never know when your company will stop loving you!
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 819

You want to have a left outer join with a table that contains all the months.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL for monthly report with each month must be selected even if there is no data
 
Similar Threads
calculating the number of business minutes in a month
what is the right way to load this object graph. real world problem
OutOfMemoryError
how to display all months of a particular year according to the following rule
oracle date between