[thelist] sql query for sum of timediff

Canfield, Joel JCanfield at PacAdvantage.org
Thu Jun 1 17:51:45 CDT 2006


using mysql 4 on windows

(a/c is out, haven't slept in eight weeks, blah blah blah; brain
!working)

table has, among others, columns firstname, lastname, starttime, endtime
(start of call, end of call)

multiple entries differing only by starttime and endtime

I want something like

    select firstname, lastname, sum(timediff(endtime,starttime)) from
presence where starttime between '2006-05-31 0:00:00' and '2006-05-31
23:59:59' group by ?????

as in, the total amount of time each person was on the phone for the
given time period

can't seem to get the grouping correct; keep getting zero sum, or only
one name

muchly thankage

joel



More information about the thelist mailing list