[thelist] sql query for sum of timediff

Canfield, Joel JCanfield at PacAdvantage.org
Fri Jun 2 10:10:35 CDT 2006


> If you do this, do you get any rows?:
> 
> select *
> from presence
> where starttime is null OR endtime is null

yup; some endtimes are null, which would whack the calculation, huh?

so, adding 'and endtime is not null' still gives me unusual results,
five zeroes and a one, when I know the totals should be between 5 and 8
hours; perhaps it's the format? but if I try

    date_format(sum(timediff(endtime,starttime)),'%H:%i:%s')

they're all null.



More information about the thelist mailing list