
23 Oct
2007
23 Oct
'07
12:16 p.m.
I wrote a SQL query to do that.
This one queries the database for all closed succesful tickets, calculating the time between creation and closing.
SELECT tn, customer_id, create_time, freetime1 AS real_close_time, DATEDIFF(freetime1, create_time) AS open_days, TIMEDIFF(freetime1, create_time) AS open_time
FROM ticket
WHERE ticket_state_id=2 AND '2007-01-01'