How to use TIMESTAMPDIFF with joined tables
Posted on 2009-02-16
How do you use TIMESTAMPDIFF when you have joined tables?
What I'm trying to do is to select the time difference between two joined tables. Some of the times are on different days (e.g. started at night, ended in the morning).
_starttime and _endtime are both on regular mysql time format (HH:MM:SS)
`b`.`orderno`, `a`.`_starttime`, `b`.`_endtime`, TIMESTAMPDIFF(`b`.`_endtime`, `a`.`_starttime)
_tbl_a AS a ON `a`.`_orderno` = `b`.`_orderno`
I'm using MySql 5.1.
Thank you for your help.