Bug #50153 Error in summing time
Submitted: 7 Jan 2010 19:35 Modified: 8 Jan 2010 6:29
Reporter: xstatic87 xstatic87 Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version: OS:Windows (xp sp3)
Assigned to: CPU Architecture:Any
Tags: time, time error

[7 Jan 2010 19:35] xstatic87 xstatic87
I'm using PHP inorder to calculate the total ammount of hours made in a week, month and year of job.
I have a DB that has many records, each one of them has a total ammount of hours stored (i.e: 2:20), when I sum up two different records (with "SELECT Sec_to_Time(Sum(Time_to_Sec(admin))) AS totssn FROM...") gets summed correctly.
The point of mistake is when I try to sum more records, the mysql db sums it but goes up to 859:59:59, not more than that.
The query I use is:
$global = mysql_query("SELECT Sec_to_Time(Sum(Time_to_Sec(ssn))) AS global FROM ssns WHERE audId = '".$_SESSION['audLogin']."'")
And than to see the query result is "mysql_result($global, 0)".
Again, it works all fine until I get up to 859:59:59 hours after that it stops summing.

How to repeat:
By creating a DB with 50 records, each containing 23:00 hours and by summing them with the query I gave ("SELECT Sec_to_Time(Sum(Time_to_Sec(ssn))) AS global FROM xxx ")

Suggested fix:
See if there is any way of fixing it
[8 Jan 2010 6:29] Valeriy Kravchuk
This is a documented limitation of TIME data type. Check http://dev.mysql.com/doc/refman/5.1/en/time.html.