php_dave Posted August 5, 2008 Share Posted August 5, 2008 Guys, Sorry to dump this on you but its driving me mental! I am storing the time of an outage that is attached to a ticket. I am also storing the SLA time of a service for a customer. For example Customer A using Service A between the hours 08:00 17:00 Outage ticket for service A was between 07:00 - 09:00. The full outage time for the service was 2hrs ( i can find this out by doing datediff(endtime,starttime) - easy but I cant work out how to find out the outage time for the service for customer A - which in the real wolrd is only 1hr 08:00 till 09:00.... Hope this makes sense ??? - I have been staring at my query builder for 8 hours now and just cant work it out! Quote Link to comment Share on other sites More sharing options...
akitchin Posted August 5, 2008 Share Posted August 5, 2008 two IFs in the query might help - take the latest of both start times, the earliest of both end times when calculating the time difference. that will allow you to calculate the difference between 0900 and 0800 in this case, for example. this approach will only work for full block service times, since gaps will affect the calculation obviously. Quote Link to comment Share on other sites More sharing options...
php_dave Posted August 6, 2008 Author Share Posted August 6, 2008 Sometimes you just cant see the obvious! Thanks mate this has me on the right track now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.