List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 20 1999 1:03pm
Subject:Re: TIME
View as plain text  
On Mon, 1999-09-20 06:21:52 +0300, Bogdan Paduraru wrote:
> I have a field of TIME type and I want to sum all the values in that
> column. Is there any function or possibility to do it?

I think you can't sum up TIME values directly, but there are functions
TIME_TO_SEC and vice versa SEC_TO_TIME, so this will work:

  SELECT ..., SEC_TO_TIME( SUM( TIME_TO_SEC(timefield) ) ) AS sumtime
  FROM ...
  GROUP BY ...;

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
TIMEBogdan Paduraru20 Sep
  • Re: TIMEMartin Ramsch20 Sep