Hi ,
Please help in writing the query to get the below result i have a Requested details table which contains the data in the below formate.
Pkey | ParentId | Status | Datelogged |
---|---|---|---|
1 | 123 | Submitted | 12/9/2018 10:30 |
2 | 123 | Assigned | 12/9/2018 10:40 |
3 | 123 | Acknowledge | 12/9/2018 10:45 |
4 | 123 | OnHold | 12/9/2018 10:55 |
5 | 123 | Resloved | 12/9/2018 11:15 |
6 | 124 | Submitted | 12/9/2018 10:30 |
7 | 124 | Assigned | 12/9/2018 10:40 |
8 | 124 | Acknowledge | 12/9/2018 10:45 |
9 | 124 | OnHold | 12/9/2018 10:55 |
10 | 124 | Work In Progress | 12/9/2018 11:16 |
11 | 124 | Resloved | 12/9/2018 11:45 |
I want the result in the like below.
ParentId | Total Resolved time (min) | Actual Resolved Time (min) |
---|---|---|
123 | 45 | 25 |
124 | 75 | 54 |
total resolved time is the the total time take to resolve the ticket time difference resolved - Submitted . e.g for 123 request 12/9/2018 11:15-12/9/2018 10:30 = 45 mins
Actual resolved time is the Total resolve time - request on hold time.
e.g
for 123 request the total resolve time is 45 mins. , but the request is moved to on hold state 12/9/2018 10:55:00 AM and at 11:15 is moved directly to resolved state. so i have we have subtract 20 mins for the total resolve time . so the actual resolved time is 45-20=25 mins
For 124 request total resolved time is 75 min, the request is moved to on hold state at 12/9/2018 10:55:00 AM and then at 12/9/2018 11:16:00 AM the request is moved to work in progress state. we have subtract the 21 mins from the total resolve time. i.e. 75-21=54