Hi all,
I have a problem getting a correct result with my sql code and figured I would see if anybody could help.
I have two fields in a table that have timestamps. I want to find the difference in time between the two stamps and then calculate the average. Here is the code that I have come up with so far.
[code=mysql]SELECT AVG(TIMEDIFF(de parture_Time, arrival_Time)) as average
FROM t1
WHERE
employee_Number = '3'[/code]
I have two stamps:
Based on those timestamps and running the code will return '1408' which I believe is 14 minutes and 8 seconds. I believe that the calculations may be correct but I would either like to have a decimal point or just round out the number to 14. Again, this is the average between the two stamps.
Also, if someone has a better way of doing this, I am open to suggestions.
Thanks guys!
Frank
I have a problem getting a correct result with my sql code and figured I would see if anybody could help.
I have two fields in a table that have timestamps. I want to find the difference in time between the two stamps and then calculate the average. Here is the code that I have come up with so far.
[code=mysql]SELECT AVG(TIMEDIFF(de parture_Time, arrival_Time)) as average
FROM t1
WHERE
employee_Number = '3'[/code]
I have two stamps:
Code:
departure_Time arrival_Time 2007-09-23 13:15:29 2007-09-23 13:42:45 2007-09-23 17:26:41 2007-09-23 17:27:41
Also, if someone has a better way of doing this, I am open to suggestions.
Thanks guys!
Frank
Comment