
On 7/13/05, sharif islam
On 7/12/05, duarte.cordeiro@cm-lisboa.pt
wrote: you'll need to look at ticket_history. But search for all the rows that havfe that same ticket_id. After that, you just need to find the create action and the close... and do the math.
[...]
| ticket_id | create_time | change_time | 1444 | 2004-11-19 10:06:07 | 2004-11-19 10:06:07 | | 1444 | 2004-11-19 10:06:07 | 2004-11-19 10:06:07 | | 1444 | 2004-11-19 10:06:07 | 2004-11-19 10:06:07 | | 1444 | 2004-11-19 10:44:15 | 2004-11-19 10:44:15 | | 1444 | 2004-11-19 10:44:15 | 2004-11-19 10:44:15 | | 1444 | 2004-11-19 10:46:06 | 2004-11-19 10:46:06 | | 1444 | 2004-11-19 10:46:06 | 2004-11-19 10:46:06 | | 1444 | 2004-11-19 10:46:06 | 2004-11-19 10:46:06 | | 1444 | 2004-11-19 10:46:06 | 2004-11-19 10:46:06
ok, how about this? mysql> select max(change_time),min(create_time),datediff(max(change_time),min(create_time)) from ticket_history where ticket_id=1444; +---------------------+---------------------+---------------------------------------------+ | max(change_time) | min(create_time) | datediff(max(change_time),min(create_time)) | +---------------------+---------------------+---------------------------------------------+ | 2004-11-19 10:46:06 | 2004-11-16 16:38:14 | 3 | +---------------------+---------------------+---------------------------------------------+