From: Egor Egorov <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Re: Trouble acquiring proper AVG with TIME Date: Thu, 9 Oct 2003 17:24:14 +0300
"Charles Warren" <[EMAIL PROTECTED]> wrote:
>
> I've searched the manuals and any websites I can find but am still at a loss
> on how to calculate what I thought was going to be an easy 'Average' of Call
> Times.
>
> Situation. Have a table which is updated daily for users metrics and have
> configured one column as TIME which should have the default format (if I
> understand correctly) of HH:MM:SS.
>
> However when I try to calculate an average for an individual who has the
> following two times listed:
>
> 00:09:15
> 00:04:26
>
> it calculates the average as being 670.5
>
> The query I'm running is
>
> SELECT AVG(avg_tt)
> FROM table
> WHERE agent_ln = "name"
>
> It is changing the times to 915 + 426 = 1341/2 = 670.5
>
> Does anyone know what I'm doing wrong?
You should use AVG() with SEC_TO_TIME() and TIME_TO_SEC() functions.
-- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
thank you sooo much Egor!!
Finally got it to work with the functions you mentioned.. (think so at least.. if there is a better way please let me know.
Used: SELECT SEC_TO_TIME(AVG(TIME_TO_SEC(AVG_TT))) AS Avg_Talk_Time FROM table WHERE agent_ln = "name"
Came out with an average of 00:06:50 - when using 00:09:15 - 00:04:26
Thanks again! Chuck
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]