Print Page | Close Window

calculating average per month basis

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=4697
Printed Date: 30 March 2026 at 10:07am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: calculating average per month basis
Posted By: exo_dus
Subject: calculating average per month basis
Date Posted: 02 August 2003 at 10:58pm

Hi there... i was wondering how you would calculate data based on averages per month.... so if i wanted to calculate the average for the month of august and just output this calculated average..

e.g. 
july $100
august $100 & $200

and i ask for average it will only calculate august, as it is the current month; the answer for which is $150

thanx in advance for your help




Replies:
Posted By: ljamal
Date Posted: 02 August 2003 at 11:42pm
select avg(moneyfield), monthfield from table group by monthfield

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: exo_dus
Date Posted: 02 August 2003 at 11:47pm
i'm sorry i didn't realise this but i should've added that the date field in the database is just a date column.... no month, date and year distinguished..... so any ideas??? so i have to get the month from within the date


Posted By: ljamal
Date Posted: 02 August 2003 at 11:59pm
then replace monthfield above with
datepart(m,monthfield)

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net