elapsed for overlap time

  • Hi guys,

    i need help to fine a good approach to generate an algorithm that measures time range only in overlapping time range.

    The scenario:

    I have a typical trouble ticket, this can be in different status (open, in progress, paused...).

    It can be assigned for different working teams (business, tech...)

    Every trouble ticket can have sub-ticket end every sub-ticket can have the same scenario like the main's one.

    What i need is to count the seconds in overlapping time range where the trouble ticket has been in specific woprking status and specific working group.

    Scenario:

    <---open---><--in progress-----><---pause-------><--in progress--><closed>TT STATUS

    <--Group1------><----Group2--------------><-------------Group1---------->TT GROUP

    ..........<-open-><--in progress---><pause----><-in progress------><--closed>SUBTT STATUS

    ..........<--Group1------><----Group2--------------><-----Group1----------->SUBTT GROUP

    So the time range i need to measure is only the overlap time when the ticket (and if one exists, its sub ticket) is in:

    status: in progress, open

    group : group 1

    Every help is appreciated.

    Cris

  • I'm not sure what you need. I couldn't understand. It would help a lot if you posted table definitions (DDL statements), sample data (Insert statements) and expected output based on that sample data.

    Read the article on my signature for guidance on how to do it.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • As Luis has said, any direct help from this forum is going to need you to provide us DDL, sample data and expected results.

    But at a guess, I'd say there might be something in Itzik Ben-Gan's Packing Intervals article that will work for your case.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Thanks for your suggest guys,

    i'm reading the document about time packing intervals. When done and if needed i'll post some DDL to replicate the scenario.

    Ciao.

    C

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply