how to SUM over TIME col (without TIME_TO_SEC)?

2007-07-23 Thread Sebastian Mendel
Hi, how can i get the SUM of a TIME field without using TIME_TO_SEC()? example: SELECT SUM(`my_time`) FROM `table` GROUP BY `id` returns: 765 some completely wrong result, not formated in as TIME SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(`my_time`))) FROM `table` GROUP

Re: sum of time?

2005-10-24 Thread Dobromir Velev
I think there should be no problem to use the SUM() function - did you tried it like this select SEC_to_time(SUM(unix_timestamp(TTendTime) - unix_timestamp(TTstartTime))) as endtime FROM TimeTracking WHERE TTperson = 1 and date(TTstartTime) = '2005-10-19' HTH -- Dobromir Velev [EMAIL

Re: sum of time?

2005-10-24 Thread SGreen
[EMAIL PROTECTED] wrote on 10/24/2005 12:48:32 AM: I have a table doing time tracking. I don't use timestamps, I use datetime fields to record punch in times and punch out times. I have this query that computes the amount of time between a punch in and punch out: select

Re: sum of time?

2005-10-24 Thread Martijn Tonies
I have a table doing time tracking. I don't use timestamps, I use datetime fields to record punch in times and punch out times. I have this query that computes the amount of time between a punch in and punch out: select SEC_to_time(unix_timestamp(TTendTime) -

Re: sum of time?

2005-10-24 Thread Michael Stassen
Martijn Tonies wrote: I have a table doing time tracking. I don't use timestamps, I use datetime fields to record punch in times and punch out times. I have this query that computes the amount of time between a punch in and punch out: select SEC_to_time(unix_timestamp(TTendTime) -

Re: sum of time?

2005-10-24 Thread Michael Stassen
Michael Stassen wrote: snip 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

Re: sum of time?

2005-10-24 Thread Martijn Tonies
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

Re: sum of time?

2005-10-24 Thread Martijn Tonies
Michael Stassen wrote: snip 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)

Re: sum of time?

2005-10-24 Thread SGreen
Martijn Tonies [EMAIL PROTECTED] wrote on 10/24/2005 10:16:21 AM: Michael Stassen wrote: snip 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

Re: sum of time?

2005-10-24 Thread jabbott
On Mon, 24 Oct 2005 [EMAIL PROTECTED] wrote: Martijn Tonies [EMAIL PROTECTED] wrote on 10/24/2005 10:16:21 AM: Michael Stassen wrote: snip Second, no, it won't overflow: mysql SELECT SEC_TO_TIME(60*60*24*5); +-+ |

sum of time?

2005-10-23 Thread jabbott
I have a table doing time tracking. I don't use timestamps, I use datetime fields to record punch in times and punch out times. I have this query that computes the amount of time between a punch in and punch out: select SEC_to_time(unix_timestamp(TTendTime) - unix_timestamp(TTstartTime)) as

Re: Sum for time

2004-03-19 Thread Nitin Mehta
i dont think its possible. you can do it by using time_to_sec() function of mysql and then sec_to_time after addition Hope that helps Nitin - Original Message - From: Elly Wisata [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 19, 2004 10:08 AM Subject: Sum for time Hi

Sum for time

2004-03-18 Thread Elly Wisata
Hi *, Can somebody show me how to sum for time, my format is hh:mm:ss, need to do sum for the time as we usually sum a field with integer type. But I am not sure sum can use for time format. Thanks in advance ~Elle~