MySQL Forums
Forum List  »  Newbie

SUM of TIMEDIFF
Posted by: Ante Drnasin
Date: July 05, 2005 12:58AM

Hi there..I have a query which looks like this

SELECT TIMEDIFF(time_end, time_start)....(time_end and time_start are DATETIME) and their DIFF is ALWAYS time...

The problem is that when I use SUM on TIMEDIFF I get some strange results..I found a workaround but I don't think that this is the right method....(although it works)

SELECT SEC_TO_TIM(SUM(TIME_TO_SEC(TIMEDIFF(time_end, time_start))))...

WHich basicly means that if I want to SUM the TIMEDIFF result(which is TIME) I have to first convert the TIME to SEC and then SUM and then back to TIME with SEC_TO_TIME....

Is this the only way to SUM the TIME?Or is this a "feature" :)

Options: ReplyQuote


Subject
Written By
Posted
SUM of TIMEDIFF
July 05, 2005 12:58AM
July 09, 2005 09:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.