Hi,
I need help in MySQL creating a new field during a query that increments each iteration depending on the value of another field. This will ultimately (hopefully) be part of a stored procedure.
Here is how my table looks:
Fields:
Here is the result I would like to obtain. the fields in <> do not exist and values need to be created via the query.
The reason for multiple rows is because tickets get reassigned to different teams to work on so separate SLAs must be calculated per reassignment.
I basically need to number each ticket, ordered by updatedon asc, starting at 1 when a new ticket# begins.
for Part 2, I need to calculate the duration of each reassignment. The duration is calculated based on the "next in line", or if it's the last, then it's relation to the resolved date. Perhaps there's more than 1 way to calculate this though.
hopefully there is some voodoo that can accomplish this. We're using a tool that lacks a lot of versatility.
thanks,
-dq
I need help in MySQL creating a new field during a query that increments each iteration depending on the value of another field. This will ultimately (hopefully) be part of a stored procedure.
Here is how my table looks:
Fields:
Code:
Ticket#... updatedon... resolvedon...
INC00541 1/1/13 1/9/13
INC00541 1/3/13 1/9/13
INC00541 1/2/13 1/9/13
INC00876 1/1/13 1/11/13
INC00876 1/5/13 1/11/13
Code:
Ticket#... updatedon... resolvedon... <increment>... <duration>...
INC00541 1/1/13 1/9/13 1 1 day
INC00541 1/2/13 1/9/13 2 5 days
INC00541 1/7/13 1/9/13 3 2 days
INC00876 1/1/13 1/11/13 1 4 days
INC00876 1/5/13 1/11/13 2 6 days
I basically need to number each ticket, ordered by updatedon asc, starting at 1 when a new ticket# begins.
for Part 2, I need to calculate the duration of each reassignment. The duration is calculated based on the "next in line", or if it's the last, then it's relation to the resolved date. Perhaps there's more than 1 way to calculate this though.
hopefully there is some voodoo that can accomplish this. We're using a tool that lacks a lot of versatility.
thanks,
-dq