I have a dataset for a helpdesk system I am building a report for and I need to be able to count the maximum contact attempt for each customer. A customer can have multiple tickets open at any given time.
This is the code I am presently using
select *
from reporting
order by Job_id, seq_id, REason
SEQ_ID job_id EVENT_Name reason account_number 1 70449 Created 10341307 2 70449 Available 10341307 3 70449 Allocated 10341307 4 70449 Rescheduled Failed Contact - Attempt 1 10341307
Above is example output.
The Failed Contact Attempt can occur up to three times with the Attempt number increasing each time. So if a customer has a Failed Contact - Attempt 3 I only want to count that attempt, nothing that proceeds it.
How canI do this?
Aucun commentaire:
Enregistrer un commentaire