SqlDbx Forum

SqlDbx

You are not logged in.

#1 2010-01-21 20:00:36

x0200196
Guest

Sum of Data by Hour

I need to know how to write a query that will show the sum of data for each hour. I thought I found what I was looking for in this query:

SELECT CONVERT(VARCHAR(10),CallStartDt,120) AS date   
        ,DatePart(hh,CallStartDt) as Hour 
FROM AODCallDetail   
GROUP BY CONVERT(VARCHAR(10),CallStartDt,120),DatePart(hh,CallStartDt)

But I'm getting an error that says "120 is not a valid style number when converting from DATETIME to a character string."

Thanks

#2 2010-01-25 00:02:24

sqldbxhelp
Administrator

Re: Sum of Data by Hour

It seems to me that Sybase does not like 120 as a style in convert function.
Otherwise your query looks right

Offline

#3 2010-01-27 15:34:01

x0200196
Guest

Re: Sum of Data by Hour

Is there another style I can use then? What would I have to do to get it to run?

Board footer

Powered by FluxBB