Note that there are some explanatory texts on larger screens.

plurals
  1. POAnalyzing time-dependent, event log from SQL
    primarykey
    data
    text
    <p>I have an event log in a SQL Server database. Essentially it records when a call was made and when that call ended at a call center (as two different records), as well as a few other details. I am trying to get an idea of how many phone lines are being used at any given time with this data. I can't think of any good way to have a SQL query determine this for me, although this would be ideal (if it didn't sacrifice much speed).</p> <p>My first thought was to have a program query the start and end events for each call, determining the duration of the call. I could then step through each unit of time, keeping a tally of how many calls were in progress at any given time. Is there a way I can do this in SQL instead of using a linear method in C# or something similar?</p> <p>Edit: There is a unique ID for the calls. A session ID, if you will. Also, <strong>the start and end events are two different records</strong> -- not a single record. This complicates this a bit I think. Also, this table has over 15 million records in it.</p> <pre><code>Id EvId CallId DateTime -- ---- ------------------------------------ -------------------- 1 0 df1cbc93-5cf3-402a-940b-4441f6a7ec5c 7/9/2008 8:12:56 PM 2 1 df1cbc93-5cf3-402a-940b-4441f6a7ec5c 7/9/2008 8:13:07 PM 3 0 ec1c2078-1765-4377-9126-6f26fe33e4a9 7/10/2008 4:33:10 PM 4 10 ec1c2078-1765-4377-9126-6f26fe33e4a9 7/10/2008 4:33:13 PM 5 1 ec1c2078-1765-4377-9126-6f26fe33e4a9 7/10/2008 4:33:13 PM 6 0 a3c3b9a0-a23b-4dda-b4e4-e82f0209c94d 7/10/2008 4:33:13 PM 7 10 a3c3b9a0-a23b-4dda-b4e4-e82f0209c94d 7/10/2008 4:33:15 PM 8 1 a3c3b9a0-a23b-4dda-b4e4-e82f0209c94d 7/10/2008 4:33:15 PM 9 0 d23f393d-0272-445a-8670-3f71b016174e 7/10/2008 4:33:15 PM 10 10 d23f393d-0272-445a-8670-3f71b016174e 7/10/2008 4:33:17 PM 11 1 d23f393d-0272-445a-8670-3f71b016174e 7/10/2008 4:33:17 PM EvId Description ---- ---------------- 0 New Call 1 End of Call 2 Caller Hangup 10 CPA Completed </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload