| List: | General Discussion | « Previous MessageNext Message » | |
| From: | <jabbott | Date: | October 24 2005 4:48am |
| Subject: | sum of time? | ||
| View as plain text | |||
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 endtime
FROM TimeTracking
WHERE TTperson = 1
and date(TTstartTime) = '2005-10-19'
And this works great except for when people punch in and out several times in one day. Is
there any way I can total a number of records into one total time? In this example case,
I am TTperson #1 and I punched in and out five times this day.
I know I can do it in the code, but if I can do it in sql, life would be better for me.
--ja
--
| Thread | ||
|---|---|---|
| • sum of time? | jabbott | 24 Oct |
| • Re: sum of time? | Dobromir Velev | 24 Oct |
| • mysql + LVS | Winn Johnston | 24 Jul |
| • RE: mysql + LVS | Jimmy Guerrero | 24 Jul |
| • RE: mysql + LVS | Winn Johnston | 25 Jul |
| • RE: mysql + LVS highjacked (mysql + NFS ramfs) | Winn Johnston | 25 Jul |
| • RE: mysql + LVS highjacked (mysql + NFS ramfs) | Barry Newton | 25 Jul |
| • Re: sum of time? | SGreen | 24 Oct |
| • Re: sum of time? | Martijn Tonies | 24 Oct |
| • Re: sum of time? | Michael Stassen | 24 Oct |
| • Re: sum of time? | Michael Stassen | 24 Oct |
| • Re: sum of time? | Martijn Tonies | 24 Oct |
| • Re: sum of time? | Martijn Tonies | 24 Oct |
| • Re: sum of time? | SGreen | 24 Oct |
| • Re: sum of time? | jabbott | 24 Oct |
