Hello people,
I have been writing some queries and reports using SQL (with Crystal and ASP.NET), and have a problem. Something I often need to do is find the number of records for each month, so there is a date field and a currency field, and I need to sum all the currency values for each month.
Firstly, to get a group for each month of each year I am using ....GROUP BY Month(DateField), Year(DateField)
is this correct or is there a better way?
The more problematic thing is, where there are no records for certain month, of course this month does not show up in the query results. This is a problem when displaying results in a table/chart. Is there any way to force each month to appear (with a 0 in the SUMed field)?
Any advice would be most, most welcome,
Thanks