473,516 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hourly avg help

6 New Member
Please help! im new to SQL and im finding a way of calculating an hourly avg difficult.

This is what i have so far for all the data for the week - but i want an hourly avg instead of every second of everyday between. Please help! thanks


select "computerName" , "TimeSampled", "PerformanceCounterName", "SampledValue"
from dbo.SDKPerformanceview
where computername like 'dmm%' and performancecountername like 'total messages submitted'
and timesampled between '2007-05-14 00:00:00' and '2007-05-20 23:59:00'
May 22 '07 #1
9 2695
pradeep kaltari
102 Recognized Expert New Member
Please help! im new to SQL and im finding a way of calculating an hourly avg difficult.

This is what i have so far for all the data for the week - but i want an hourly avg instead of every second of everyday between. Please help! thanks


select "computerName" , "TimeSampled", "PerformanceCounterName", "SampledValue"
from dbo.SDKPerformanceview
where computername like 'dmm%' and performancecountername like 'total messages submitted'
and timesampled between '2007-05-14 00:00:00' and '2007-05-20 23:59:00'
Hi,
Try this:
Expand|Select|Wrap|Line Numbers
  1. SELECT AVG(col_name), DATE_FORMAT(timestamp_column,'%Y/%m/%d %h %p')
  2. FROM <table_name>
  3. WHERE <some condition>
  4. GROUP BY DATE_FORMAT(timestamp_column,'%H')
  5.  
I hope this helps you.

Regards,
Pradeep.
May 22 '07 #2
tommo5
6 New Member
I have tried to follow this but im getting loads of errors......

Are you able to help me out by adding my bits into your code? sorry im really a beginner to all this
May 22 '07 #3
pradeep kaltari
102 Recognized Expert New Member
I have tried to follow this but im getting loads of errors......

Are you able to help me out by adding my bits into your code? sorry im really a beginner to all this
Hi,
You said you want hourly average. Could you please be more clear as in which is the column whose average you want to compute.

Regards,
Pradeep.
May 23 '07 #4
tommo5
6 New Member
sorry - i want the hourly average of the "sampledvalue"
May 23 '07 #5
pradeep kaltari
102 Recognized Expert New Member
sorry - i want the hourly average of the "sampledvalue"
Hi,
Have you tried the following query:

Expand|Select|Wrap|Line Numbers
  1. SELECT AVG(sampledvalue), DATE_FORMAT(timesampled,'%Y/%m/%d %h %p')
  2. FROM SDKPerformanceview
  3. WHERE computername LIKE 'dmm%' AND performancecountername LIKE 'total messages submitted'  AND timesampled between '2007-05-14 00:00:00' AND '2007-05-20 23:59:00'
  4. GROUP BY DATE_FORMAT(timesampled,'%H')
  5.  
If you are getting any errors with this then please post them.

Regards,
Pradeep.
May 23 '07 #6
tommo5
6 New Member
im getting

Server: Msg 195, Level 15, State 10, Line 1
'DATE_FORMAT' is not a recognized function name.
May 23 '07 #7
pradeep kaltari
102 Recognized Expert New Member
Which version of MySQL are you using?
May 23 '07 #8
tommo5
6 New Member
i believe im using version 8 of the query analyser
May 23 '07 #9
pradeep kaltari
102 Recognized Expert New Member
im getting

Server: Msg 195, Level 15, State 10, Line 1
'DATE_FORMAT' is not a recognized function name.
Hi,
I guess you are using SQL SERVER database. Please confirm.
May 23 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2196
by: Philip D Heady | last post by:
I'm in need of a good PHP programmer to help me with my lodgings website asap. Someone who can work on it during the day for a few hrs while I'm at work would be great. Prefer they live in USA eastern standard time zone. Please send me your hourly rate, slill level, website references, and availability asap. Thank you. Philip D. Heady
5
1698
by: Anthony | last post by:
First time here so please bear with me. Set up a DTS package to export data to an excel sheet on an hourly basis. Problem is, it keeps appending to the same excel sheet. Any idea how to prevent that. All I want to accomplish is that every hour, the latest data is in the excel sheet and the previous data is deleted. Thanks in advance!
4
3477
by: Sam | last post by:
Hello everyone, I have around 20 reports in an ASP web-application which connects to a SQL Server 2000 dB, executes stored procedures based on input parameters and returns the data in a nice tabular format. The data which is used in these reports actually originates from a 3rd party accounting application called Exchequer. I have written...
3
1665
by: Brett | last post by:
For those of you working hourly, are you paid time and a half for anything over 40 hours? Say you are making $50/hour. Once you go over 40, your rate goes up to $75. If so, do you find it difficult to get that rate? In other words, does management hangle and bicker with you and in the end make you end up working for the $50 rate? How...
7
9794
by: Compliance | last post by:
Apologies for the simplicity of the question, but it reflects my capabilities! I have the following sample fields coming from different tables: Location TimeDate (timestamp) Data I need to return the average of Data per Location per HOUR.
13
5973
by: danceli | last post by:
I have two servers, using SQL server 2000. I was asked for implementing hourly Backup 3 databases in one server and restore those databases to another server. Could anyone give me the detailed steps to do that? Thanks a lot in advance!
4
4417
by: MPD | last post by:
Hi How can I create a job in sql agent to create a new snapshot every hour? I have, for eg a T-SQL that does it manually. create database Snapshotter_snap_20070418_1821 on ( name = Snapshotter, filename = 'c:\temp\Snapshotter_snap_20070418_1821.ss') as snapshot of Snapshotter
0
1069
by: tommo5 | last post by:
Please help! im new to SQL and im finding a way of calculating an hourly avg difficult. This is what i have so far for all the data for the week - but i want an hourly avg instead of every second of everyday between. Please help! thanks select "computerName" , "TimeSampled", "PerformanceCounterName", "SampledValue" from...
4
3919
by: Missionary2008 | last post by:
Thank you in advance for your help. I'm trying to calculate the Total Time in hours and minutes to complete a job. The way we are calculating it is by taking the Fee paid and dividing that by a 1:00. In Excel - Marsh is charged $90.00 (This is pre-determined) Her job is a $25.00/hour job (This is pre-determined) ...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.