Hi,

 

We’d like to be able to calculate the time it takes for us to answer tickets.  

 

I found the following code in the logs (slightly modified):

SELECT ticket.tn, timediff(ticket_history.create_time, ticket.create_time) AS 'diff' from ticket LEFT JOIN ticket_history ON ticket.id=ticket_history.ticket_id

WHERE ticket.create_time > '2007-11-01 00:00:00'

AND ticket_history.history_type_id = 15

AND ticket_history.name = '%%close'

AND ticket_history.create_time > '2007-11-01 00:00:00'

ORDER BY ticket_history.create_time

 

Unfortunately this has one small problem for us.

 

For example: If a customer write to us on Nov 1 and we answer immediately, then he writes again on November 5 and we answer immediately, the “time difference” calculated is 4 days. This messes up our statistics – since really we answered immediately each time!

 

Could anyone tell me how I can either:

1) calculate the difference between one contact and its corresponding answer OR

2) find out which customers have written more than once on the same ticket, such that I can exclude them in my query.

3) Any other workarounds?

 

Thanks very much and happy holidays!

 

Tabitha