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'
9 2695
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: -
SELECT AVG(col_name), DATE_FORMAT(timestamp_column,'%Y/%m/%d %h %p')
-
FROM <table_name>
-
WHERE <some condition>
-
GROUP BY DATE_FORMAT(timestamp_column,'%H')
-
I hope this helps you.
Regards,
Pradeep.
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
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.
sorry - i want the hourly average of the "sampledvalue"
sorry - i want the hourly average of the "sampledvalue"
Hi,
Have you tried the following query: -
SELECT AVG(sampledvalue), DATE_FORMAT(timesampled,'%Y/%m/%d %h %p')
-
FROM 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'
-
GROUP BY DATE_FORMAT(timesampled,'%H')
-
If you are getting any errors with this then please post them.
Regards,
Pradeep.
im getting
Server: Msg 195, Level 15, State 10, Line 1
'DATE_FORMAT' is not a recognized function name.
Which version of MySQL are you using?
i believe im using version 8 of the query analyser
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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!
|
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...
|
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...
|
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.
| |
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!
|
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
|
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...
|
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)
...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |