Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to detrimine date duration, minus weekend days and days on hold

$
0
0

I need to determine duration of a request by when the request went from Milestone_ 3 to Milestone_8 (but if Milestone_8 is null use Milestone_7) minus weekend minutes.

But I also need to find the days when a request was On Hold and subtract those days from the duration (not counting weekend days it was On Hold), note: a request can go from On Hold to Open several times.

So times for when a request was On Hold are located in the comments table (of all places), there are three different times

  1. WHEN LOG_COMMENTS LIKE '%status changed from open to on hold%' OPEN_OH
  2. WHEN LOG_COMMENTS LIKE '%status changed from on hold%' OH_OPEN
  3. WHEN LOG_COMMENTS LIKE '%Status changed from On Hold to Close%' OH_CLOSE

I have gathered all the required fields/columns from 3 different tables into one table because I thought it would be easier, but I’m struck at this point.

Expected results would be UNIVERSL_ID, Duration (minus weekend days), Days On Hold (not counting weekend days), and Total Days (Duration minus On Hold)

Can you help? Thx


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>