> >>This translated to SQL as:
> >>
> >>select SEC_to_time(SUM(unix_timestamp(TTendTime)) -
> >>SUM(unix_timestamp(TTstartTime)))
> >>as endtime
> >>FROM TimeTracking
> >>WHERE TTperson = 1
> >>    and date(TTstartTime) = '2005-10-19'
> >
> > Won't this fail if it overflows 24 hours?
> >
> > Given that the result of SEC_TO_TIME seems to be a valid "time value",
> > which "duration" is not?
> >
> > eg: a duration can be 25 hours long, while a TIME value cannot.
>
> First, it is hard to imagine how that would happen given the OP's
situation.
>
> Second, no, it won't overflow:
>
>    mysql> SELECT SEC_TO_TIME(60*60*24*5);
>    +-------------------------+
>    | SEC_TO_TIME(60*60*24*5) |
>    +-------------------------+
>    | 120:00:00               |
>    +-------------------------+
>    1 row in set (0.00 sec)
>
>    mysql> SELECT SEC_TO_TIME(60*60*24*50);
>    +--------------------------+
>    | SEC_TO_TIME(60*60*24*50) |
>    +--------------------------+
>    | 1200:00:00               |
>    +--------------------------+
>    1 row in set (0.00 sec)
>
> SEC_TO_TIME() is not limited to 24 hours.

Aha, right - thanks for that.

It seems to be a display error on my side :-)

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to