2 messages in com.mysql.lists.win32Re: Time summazion
FromSent OnAttachments
Rene Harder Olsen23 Sep 2004 06:27 
Petr Vileta23 Sep 2004 14:13 
Subject:Re: Time summazion
From:Petr Vileta (pe@practisoft.cz)
Date:09/23/2004 02:13:24 PM
List:com.mysql.lists.win32

The only problem is that the values are not matching. To try to describe it at little more is that I have rows with time as 00:02:16 when it is tranfered into seconds it should show 136 of whatever it is that mysql has made a sum of. The command used is sum(fieldname) group by the unit to which I want to group for. Hoping that it makes sense.

Try SELECT SUM(TIME_TO_SEC( DATE_FORMAT(fieldname,'%h:%i:%s')));

or if you want to omit the hours, you can use SELECT SUM(TIME_TO_SEC( DATE_FORMAT(fieldname,'%i:%s')));