Posted by brant : 2009-10-05 at 6:17 pm

MySQL queries that use SUM(time) may notice that it doesn't work as intended, so a workaround is clearly neccessary.  I Googled for the answer and was pleased to find one that does infact work perfectly.  Stoyan Stefanov was nice enough to post the workaround on the MySQL site.  Below is the trick which results in the following format: 00:00:00.

SELECT
  SEC_TO_TIME( SUM( TIME_TO_SEC( `time` ) ) ) AS total_time
FROM time_table;



Similar Blogs:
Enable Remote Access To MySQL With WHM / Cpanel Hosting Packages
Optimize Your Queries!
Awstats Will Lag Your Box

blog comments powered by Disqus