For a current project I am working I need to return an aggregate report based on date ranges.
I have 3 types of reports, yearly, monthly and daily.
To assis
If you prefer a set-based solution, use a tactic like the one shown in the following link to produce a range of numeric values from x to y. Then, just join to it with DATEADD() and your own custom limits to create ranges of days, months, quarters, years, or whatever else. I find it helpful to have this range query as a view.
Generate Ranges In SQL