Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

elapsed for overlap time Expand / Collapse
Author
Message
Posted Tuesday, February 25, 2014 4:19 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, May 28, 2014 7:21 AM
Points: 8, Visits: 109
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
Post #1544826
Posted Tuesday, February 25, 2014 8:18 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 7:51 PM
Points: 3,354, Visits: 7,251
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.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1544964
Posted Tuesday, February 25, 2014 5:20 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 12:45 AM
Points: 3,614, Visits: 5,227
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!

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?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
Post #1545179
Posted Wednesday, February 26, 2014 3:27 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, May 28, 2014 7:21 AM
Points: 8, Visits: 109
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
Post #1545296
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse