Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Query Help

Status
Not open for further replies.

rsunra

IS-IT--Management
Sep 30, 2003
53
0
0
AU
G'day

I have a field Stored as a Varchar on the format 00:00:00 and I want to get a 15 min average group day the day

I have the follow code:

What I think I need to do is first convert the Varchar to HH:mm:ss using the convert(char(9),[call_duration],14) as Duration

How can I set the Average call duration using a Case Statement?

ie AVG (Duration(CASE WHEN DATEPART(hour,[call_start]) = 0 and DATEPART(mi,[call_start]) BETWEEN 00 and 15 ) AS '00:00-00:15',

 
CASE
WHEN DATEPART(hour,[call_start]) = 0 and DATEPART(mi,[call_start]) BETWEEN 00 and 15 ) THEN '00:00-00:15'
END
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top