Connecting Tech Pros Worldwide Help | Site Map

Charts

rcollins's Avatar
Familiar Sight
 
Join Date: Aug 2006
Location: Grand Junction, CO
Posts: 233
#1: Mar 11 '08
I am new at charts. I want to make a chart that gives me the amount of incidents per month. Shouldn't be that hard but at the moment the best I get is totaling all of the month values for each year all together. For instance, December has the count of all december incidents from 01 to 08. I want to also put a start and end date to these. Please help to point me in the right direction
Moderator
 
Join Date: Feb 2008
Location: Beauly, near Inverness, Scotland
Posts: 1,576
#2: Mar 12 '08

re: Charts


Quote:

Originally Posted by rcollins

I am new at charts. I want to make a chart that gives me the amount of incidents per month. Shouldn't be that hard but at the moment the best I get is totaling all of the month values for each year all together. For instance, December has the count of all december incidents from 01 to 08. I want to also put a start and end date to these. Please help to point me in the right direction

Hi. You need to add the year as a Group By clause in your base query. You can add criteria to your query to select dates between particular dates you are interested in.

General SQL for this is along the lines of
Expand|Select|Wrap|Line Numbers
  1. SELECT [yourtable].[year], [yourtable].[month], Count([yourtable].[month]) AS N
  2. FROM [yourtable] 
  3. WHERE ([yourtable].[rowdate] between #somedate# AND #anotherdate#
  4. GROUP BY [yourtable].[year], [yourtable].[month]
  5. ORDER BY [yourtable].[year], [yourtable].[month];
-Stewart
Reply