You are here: Re: Hourly Average « MsSQL Server « IT news, forums, messages
Re: Hourly Average

Posted by Roy Harvey on 08/17/06 18:50

I checked the syntax and what I posted seems clean, other than the
lack of the FROM clause. I adapted it to a meaningess example using
an actual table:

SELECT id,
dateadd(hour,datediff(hour,0,crdate),0) as Hourly,
avg(schema_ver) as AvgData
FROM sysobjects
GROUP BY
id,
dateadd(hour,datediff(hour,0,crdate),0)

If you can't find the problem, past the exact code that is not
executing into your reply.

Roy Harvey
Beacon Falls, CT

On 17 Aug 2006 11:24:46 -0700, "Compliance" <comcontrol@aol.com>
wrote:

>Roy:
>
>Thanks for the reply! I have run this and am getting a syntax error on
>the second line which says there is incorrect syntax near the '(' . I
>played with spacing but could not resolve. Do you have any tips?
>Also, is it inappropriate
>
>Roy Harvey wrote:
>> I believe this will do it.
>>
>> SELECT Location,
>> dateadd(hour,datediff(hour,0,TimeDate),0) as Hourly,
>> avg(Data) as AvgData
>> FROM .....
>> GROUP BY
>> Location,
>> dateadd(hour,datediff(hour,0,TimeDate),0)
>>
>> Roy Harvey
>> Beacon Falls, CT
>>
>> On 17 Aug 2006 09:31:32 -0700, "Compliance" <comcontrol@aol.com>
>> wrote:
>>
>> >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.
>> >
>> >Thanks.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация