| 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.
|
 |
 |
|
|
subject: SQL for monthly report with each month must be selected even if there is no data
|
|
|