SQl to calculate average time for call centre agents

  • Thanks, but that table definition doesn't match the table you've provided. Could you please provide CREATE and INSERT statements that work together?

    I've had a look at your data, but without column definitions i don't know what each represents. I can't easily determine which one shows where a one call ends and another begins. How do i determine this? Perhaps having a Wrap up determines it? Anything else that might?

    Thanks.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Thom A - Friday, October 6, 2017 10:15 AM

    Thanks, but that table definition doesn't match the table you've provided. Could you please provide CREATE and INSERT statements that work together?

    I've had a look at your data, but without column definitions i don't know what each represents. I can't easily determine which one shows where a one call ends and another begins. How do i determine this? Perhaps having a Wrap up determines it? Anything else that might?

    Thanks.

    I made the assumption that a call ends on WrapUp.  It's a common term for call centers.  That's part of why this isn't just a simple walk in the park.  First order of business is to determine the duration of a given event, which is likely to be from a given record to the next different event type record in time sequence.  It looks from the data that the same event type would not occur twice in succession, so the data appears to be a "true event log" type of thing.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • sgmunson - Friday, October 6, 2017 10:19 AM

    I made the assumption that a call ends on WrapUp.  It's a common term for call centers.  That's part of why this isn't just a simple walk in the park.  First order of business is to determine the duration of a given event, which is likely to be from a given record to the next different event type record in time sequence.  It looks from the data that the same event type would not occur twice in succession, so the data appears to be a "true event log" type of thing.

    Agreed, it does look like that. I actually think that a better point might actually be 'InteractionComplete' rather than Wrap Up. I'm thinking of creating islands for each call by using those, and the operator (which i assume is the column with "agentx" in. You could then use LEAD to get the start of the next status, get the difference between those 2 times (in seconds) and then do the logic above I posted.

    Without column headings though, I'd rather not second guess what the data represents, and provide the OP with an answer that is wrong. Hopefully he'll have something posted after the weekend is through, as i doubt I'll get a chance to look at home over the weekend.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Zalouncha - Friday, October 6, 2017 9:53 AM

    Hi Thom A,

    Do you mean the Create script for the table hosting the data?

    if so please see below:

    /****** Object: Table [dbo].[CALLSTATUSLOGGING]  Script Date: 06/10/2017 16:52:33 ******/
    SET ANSI_NULLS ON
    GO

    SET QUOTED_IDENTIFIER ON
    GO

    SET ANSI_PADDING ON
    GO

    CREATE TABLE [dbo].[CALLSTATUSLOGGING](
        [CALLSTATID] [int] IDENTITY(1,1) NOT NULL,
        [CLIENTNO] [int] NULL,
        [CALLLOGID] [int] NULL,
        [CPGNO] [int] NULL,
        [CALLSTATE] [varchar](200) NULL,
        [LOCALISEDCALLSTATE] [nvarchar](200) NULL,
        [STATETIMEAGT] [datetime] NULL,
        [USEDBYAGENT] [varchar](30) NULL,
        [LOGAGENTNO] [int] NULL,
        [CALLLOGREF] [varchar](50) NULL,
        [COMPLETECODE] [varchar](10) NULL,
        [CTI_USER] [varchar](20) NULL,
    PRIMARY KEY CLUSTERED
    (
        [CALLSTATID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO

    SET ANSI_PADDING OFF
    GO

    If you'd post the proper CREATE TABLE statement for the SELECT/UNION ALL statements you posted, I'm just betting that someone would jump on this problem with a solution in no time... maybe even me. 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden - Saturday, October 7, 2017 1:22 AM

    Zalouncha - Friday, October 6, 2017 9:53 AM

    Hi Thom A,

    Do you mean the Create script for the table hosting the data?

    if so please see below:

    /****** Object: Table [dbo].[CALLSTATUSLOGGING]  Script Date: 06/10/2017 16:52:33 ******/
    SET ANSI_NULLS ON
    GO

    SET QUOTED_IDENTIFIER ON
    GO

    SET ANSI_PADDING ON
    GO

    CREATE TABLE [dbo].[CALLSTATUSLOGGING](
        [CALLSTATID] [int] IDENTITY(1,1) NOT NULL,
        [CLIENTNO] [int] NULL,
        [CALLLOGID] [int] NULL,
        [CPGNO] [int] NULL,
        [CALLSTATE] [varchar](200) NULL,
        [LOCALISEDCALLSTATE] [nvarchar](200) NULL,
        [STATETIMEAGT] [datetime] NULL,
        [USEDBYAGENT] [varchar](30) NULL,
        [LOGAGENTNO] [int] NULL,
        [CALLLOGREF] [varchar](50) NULL,
        [COMPLETECODE] [varchar](10) NULL,
        [CTI_USER] [varchar](20) NULL,
    PRIMARY KEY CLUSTERED
    (
        [CALLSTATID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO

    SET ANSI_PADDING OFF
    GO

    If you'd post the proper CREATE TABLE statement for the SELECT/UNION ALL statements you posted, I'm just betting that someone would jump on this problem with a solution in no time... maybe even me. 😉

    Hi Jeff I thought that was the correct create table script. The data dump I sent was contained in that table. Actually I think I omitted on column which had null values. I apologise for that. I am only new and getting to understand how to go about wording my questions?

  • Zalouncha - Saturday, October 7, 2017 1:37 AM

    Hi Jeff I thought that was the correct create table script. The data dump I sent was contained in that table. Actually I think I omitted on column which had null values. I apologise for that. I am only new and getting to understand how to go about wording my questions?

    The problem with your data is it's just a select statement. All the data types are varchar, and there are no column headings. Then, in a latter post, you provided table DDL that didn't match that select statement. This means, firstly, we can't use your table structure (we have no data for it). Also we'd have to make assumptions on your data types (are they really ALL varchars? I doubt it, but if so that'll make things harder) and guess what they represent. For example, what does the varchar value '43063' mean? Without a column heading, I have no idea.

    Like Jeff said, have a look at the link again; it explains how to provide DDL and DLM. Once you've got that posted I, or someone else, can provide a much more informed answer, with a SQL solution. Until then, the best we can give are ideas on how to solve your problem, and not a solution. I also made a post earlier in the topic that shows an example of how to provide the data.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Zalouncha - Saturday, October 7, 2017 1:37 AM

    Jeff Moden - Saturday, October 7, 2017 1:22 AM

    Zalouncha - Friday, October 6, 2017 9:53 AM

    Hi Thom A,

    Do you mean the Create script for the table hosting the data?

    if so please see below:

    /****** Object: Table [dbo].[CALLSTATUSLOGGING]  Script Date: 06/10/2017 16:52:33 ******/
    SET ANSI_NULLS ON
    GO

    SET QUOTED_IDENTIFIER ON
    GO

    SET ANSI_PADDING ON
    GO

    CREATE TABLE [dbo].[CALLSTATUSLOGGING](
        [CALLSTATID] [int] IDENTITY(1,1) NOT NULL,
        [CLIENTNO] [int] NULL,
        [CALLLOGID] [int] NULL,
        [CPGNO] [int] NULL,
        [CALLSTATE] [varchar](200) NULL,
        [LOCALISEDCALLSTATE] [nvarchar](200) NULL,
        [STATETIMEAGT] [datetime] NULL,
        [USEDBYAGENT] [varchar](30) NULL,
        [LOGAGENTNO] [int] NULL,
        [CALLLOGREF] [varchar](50) NULL,
        [COMPLETECODE] [varchar](10) NULL,
        [CTI_USER] [varchar](20) NULL,
    PRIMARY KEY CLUSTERED
    (
        [CALLSTATID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO

    SET ANSI_PADDING OFF
    GO

    If you'd post the proper CREATE TABLE statement for the SELECT/UNION ALL statements you posted, I'm just betting that someone would jump on this problem with a solution in no time... maybe even me. 😉

    Hi Jeff I thought that was the correct create table script. The data dump I sent was contained in that table. Actually I think I omitted on column which had null values. I apologise for that. I am only new and getting to understand how to go about wording my questions?

    There are 9 columns in the data and 12 columns in the table.  Also, adding the correct INSERT statement for the data you've posted would also be helpful.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Zalouncha - Saturday, October 7, 2017 1:37 AM

    Jeff Moden - Saturday, October 7, 2017 1:22 AM

    Zalouncha - Friday, October 6, 2017 9:53 AM

    Hi Thom A,

    Do you mean the Create script for the table hosting the data?

    if so please see below:

    /****** Object: Table [dbo].[CALLSTATUSLOGGING]  Script Date: 06/10/2017 16:52:33 ******/
    SET ANSI_NULLS ON
    GO

    SET QUOTED_IDENTIFIER ON
    GO

    SET ANSI_PADDING ON
    GO

    CREATE TABLE [dbo].[CALLSTATUSLOGGING](
        [CALLSTATID] [int] IDENTITY(1,1) NOT NULL,
        [CLIENTNO] [int] NULL,
        [CALLLOGID] [int] NULL,
        [CPGNO] [int] NULL,
        [CALLSTATE] [varchar](200) NULL,
        [LOCALISEDCALLSTATE] [nvarchar](200) NULL,
        [STATETIMEAGT] [datetime] NULL,
        [USEDBYAGENT] [varchar](30) NULL,
        [LOGAGENTNO] [int] NULL,
        [CALLLOGREF] [varchar](50) NULL,
        [COMPLETECODE] [varchar](10) NULL,
        [CTI_USER] [varchar](20) NULL,
    PRIMARY KEY CLUSTERED
    (
        [CALLSTATID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO

    SET ANSI_PADDING OFF
    GO

    If you'd post the proper CREATE TABLE statement for the SELECT/UNION ALL statements you posted, I'm just betting that someone would jump on this problem with a solution in no time... maybe even me. 😉

    Hi Jeff I thought that was the correct create table script. The data dump I sent was contained in that table. Actually I think I omitted on column which had null values. I apologise for that. I am only new and getting to understand how to go about wording my questions?

    Understood.  Count the columns and you'll see what I'm talking about.  One of the best things that you can do once you've created "readily consumable data" is to run the code you're getting ready to post before you post it.  If it doesn't actually produce the table or errors out for you, it'll do the same for us and we end up wasting your time and our time trying to get some readily consumable data to help provide you with a nice, working, coded answer.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • As others on here have mentioned...your data is is being collected by the application in a logging format so your first step is to determine the duration for each status change before you can think about any kind of aggregation methods. To do this...you need to find when the next status for a given Agent occurs. Once you have that...it's a simple datediff function to determine how long an Agent was in a particular status for.

    I copied your data and made some small changes (mainly just assigned column names and correct data types) to help get you to step 1...determine how long an agent was in a given status for until their next status change. That's what the code below is doing for you. It will create a TimeElapsed column that can then be used for all the aggregations that you may want to do after the fact.


    With GarbageData as
    (
    SELECT
            --I just randomly named your columnns...I do not care about anything other than the timestamps that statuses occured
            --and the Agent for which they occured
         --Ensure this is actually an INT and not a varchar
         cast('1' as INT) as YourID
         ,'0' as Column2
         ,'41341' Column3
         ,'0' as Column4
         ,'StartApplication''Application Start' as [Status]
         --ensure this is actually date
         ,cast('Sep 5 2017 7:38AM' as datetime) as Created
         ,'agent1' as AgentID
         ,'3338' as Column8
         ,'StartApplication' as Column9
         UNION ALL
    SELECT '2','0','41343','0','StartApplication''Application Start','Sep 5 2017 7:51AM','agent2','3340','StartApplication' UNION ALL
    SELECT '3','1679235','41343','16','Talking''Call time','Sep 5 2017 8:04AM','agent2','3340','Talking' UNION ALL
    SELECT '4','1679236','41341','16','Talking''Call time','Sep 5 2017 8:04AM','agent1','3338','Talking' UNION ALL
    SELECT '5','1679235','41343','16','WrapUp''Wrap Time','Sep 5 2017 8:07AM','agent2','3340','WrapUp' UNION ALL
    SELECT '6','1679235','41343','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:07AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '7','1679238','41350','16','Talking''Call time','Sep 5 2017 8:08AM','agent2','3340','Talking' UNION ALL
    SELECT '8','1679236','41341','16','WrapUp''Wrap Time','Sep 5 2017 8:12AM','agent1','3338','WrapUp' UNION ALL
    SELECT '9','1679236','41341','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:12AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '10','1679248','41360','16','Talking''Call time','Sep 5 2017 8:15AM','agent1','3338','Talking' UNION ALL
    SELECT '11','1679248','41360','16','WrapUp''Wrap Time','Sep 5 2017 8:18AM','agent1','3338','WrapUp' UNION ALL
    SELECT '12','1679248','41360','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:19AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '13','1679238','41350','16','WrapUp''Wrap Time','Sep 5 2017 8:20AM','agent2','3340','WrapUp' UNION ALL
    SELECT '14','1679238','41350','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:21AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '15','1679257','41369','16','Talking''Call time','Sep 5 2017 8:21AM','agent2','3340','Talking' UNION ALL
    SELECT '16','1679265','41379','16','Talking''Call time','Sep 5 2017 8:27AM','agent1','3338','Talking' UNION ALL
    SELECT '17','1679265','41379','16','Hold''Hold','Sep 5 2017 8:30AM','agent1','3338','Hold' UNION ALL
    SELECT '18','1679265','41379','16','Talking''Call time','Sep 5 2017 8:34AM','agent1','3338','Talking' UNION ALL
    SELECT '19','1679265','41379','16','Hold''Hold','Sep 5 2017 8:34AM','agent1','3338','Hold' UNION ALL
    SELECT '20','1679265','41379','16','Talking''Call time','Sep 5 2017 8:34AM','agent1','3338','Talking' UNION ALL
    SELECT '21','1679265','41379','16','WrapUp''Wrap Time','Sep 5 2017 8:36AM','agent1','3338','WrapUp' UNION ALL
    SELECT '22','1679265','41379','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:36AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '23','1679257','41369','16','WrapUp''Wrap Time','Sep 5 2017 8:36AM','agent2','3340','WrapUp' UNION ALL
    SELECT '24','1679257','41369','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:36AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '25','1679285','41399','16','Talking''Call time','Sep 5 2017 8:36AM','agent2','3340','Talking' UNION ALL
    SELECT '26','1679285','41399','16','Hold''Hold','Sep 5 2017 8:40AM','agent2','3340','Hold' UNION ALL
    SELECT '27','1679295','41408','16','Talking''Call time','Sep 5 2017 8:42AM','agent1','3338','Talking' UNION ALL
    SELECT '28','1679285','41399','16','Talking''Call time','Sep 5 2017 8:43AM','agent2','3340','Talking' UNION ALL
    SELECT '29','1679295','41408','16','Hold''Hold','Sep 5 2017 8:44AM','agent1','3338','Hold' UNION ALL
    SELECT '30','0','41416','0','StartApplication''Application Start','Sep 5 2017 8:45AM','agent3','3363','StartApplication' UNION ALL
    SELECT '31','1679295','41408','16','WrapUp''Wrap Time','Sep 5 2017 8:46AM','agent1','3338','WrapUp' UNION ALL
    SELECT '32','1679295','41408','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:46AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '33','1679309','41424','16','Talking''Call time','Sep 5 2017 8:47AM','agent1','3338','Talking' UNION ALL
    SELECT '34','1679285','41399','16','WrapUp''Wrap Time','Sep 5 2017 8:48AM','agent2','3340','WrapUp' UNION ALL
    SELECT '35','1679285','41399','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:48AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '36','1679310','41425','16','Talking''Call time','Sep 5 2017 8:48AM','agent2','3340','Talking' UNION ALL
    SELECT '37','1679309','41424','16','WrapUp''Wrap Time','Sep 5 2017 8:53AM','agent1','3338','WrapUp' UNION ALL
    SELECT '38','1679309','41424','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:53AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '39','1679310','41425','16','WrapUp''Wrap Time','Sep 5 2017 8:54AM','agent2','3340','WrapUp' UNION ALL
    SELECT '40','1679310','41425','16','InteractionComplete''Interaction Complete','Sep 5 2017 8:55AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '41','1679325','41443','16','Talking''Call time','Sep 5 2017 8:55AM','agent2','3340','Talking' UNION ALL
    SELECT '42','1679331','41449','16','Talking''Call time','Sep 5 2017 8:57AM','agent1','3338','Talking' UNION ALL
    SELECT '43','1679343','41416','16','Talking''Call time','Sep 5 2017 9:00AM','agent3','3363','Talking' UNION ALL
    SELECT '44','1679331','41449','16','Hold''Hold','Sep 5 2017 9:01AM','agent1','3338','Hold' UNION ALL
    SELECT '45','1679325','41443','16','WrapUp''Wrap Time','Sep 5 2017 9:04AM','agent2','3340','WrapUp' UNION ALL
    SELECT '46','1679331','41449','16','Talking''Call time','Sep 5 2017 9:04AM','agent1','3338','Talking' UNION ALL
    SELECT '47','1679331','41449','16','Hold''Hold','Sep 5 2017 9:04AM','agent1','3338','Hold' UNION ALL
    SELECT '48','1679343','41416','16','WrapUp''Wrap Time','Sep 5 2017 9:05AM','agent3','3363','WrapUp' UNION ALL
    SELECT '49','1679325','41443','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:05AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '50','1679360','41477','16','Talking''Call time','Sep 5 2017 9:05AM','agent2','3340','Talking' UNION ALL
    SELECT '51','1679360','41477','16','WrapUp''Wrap Time','Sep 5 2017 9:06AM','agent2','3340','WrapUp' UNION ALL
    SELECT '52','1679360','41477','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:06AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '53','1679343','41416','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:06AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '54','1679362','41479','16','Talking''Call time','Sep 5 2017 9:06AM','agent3','3363','Talking' UNION ALL
    SELECT '55','1679363','41480','16','Talking''Call time','Sep 5 2017 9:06AM','agent2','3340','Talking' UNION ALL
    SELECT '56','1679331','41449','16','Talking''Call time','Sep 5 2017 9:07AM','agent1','3338','Talking' UNION ALL
    SELECT '57','1679362','41479','16','WrapUp''Wrap Time','Sep 5 2017 9:08AM','agent3','3363','WrapUp' UNION ALL
    SELECT '58','1679331','41449','16','WrapUp''Wrap Time','Sep 5 2017 9:08AM','agent1','3338','WrapUp' UNION ALL
    SELECT '59','1679331','41449','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:08AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '60','1679362','41479','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:08AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '61','1679370','41486','16','Talking''Call time','Sep 5 2017 9:09AM','agent3','3363','Talking' UNION ALL
    SELECT '62','1679363','41480','16','WrapUp''Wrap Time','Sep 5 2017 9:11AM','agent2','3340','WrapUp' UNION ALL
    SELECT '63','1679363','41480','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:12AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '64','1679380','41494','16','Talking''Call time','Sep 5 2017 9:12AM','agent2','3340','Talking' UNION ALL
    SELECT '65','1679387','41501','16','Talking''Call time','Sep 5 2017 9:12AM','agent1','3338','Talking' UNION ALL
    SELECT '66','1679380','41494','16','Hold''Hold','Sep 5 2017 9:15AM','agent2','3340','Hold' UNION ALL
    SELECT '67','1679387','41501','16','Hold''Hold','Sep 5 2017 9:15AM','agent1','3338','Hold' UNION ALL
    SELECT '68','1679380','41494','16','WrapUp''Wrap Time','Sep 5 2017 9:17AM','agent2','3340','WrapUp' UNION ALL
    SELECT '69','1679387','41501','16','WrapUp''Wrap Time','Sep 5 2017 9:17AM','agent1','3338','WrapUp' UNION ALL
    SELECT '70','1679380','41494','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:18AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '71','1679387','41501','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:18AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '72','1679406','41518','16','Talking''Call time','Sep 5 2017 9:18AM','agent2','3340','Talking' UNION ALL
    SELECT '73','1679406','41518','16','WrapUp''Wrap Time','Sep 5 2017 9:21AM','agent2','3340','WrapUp' UNION ALL
    SELECT '74','1679406','41518','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:21AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '75','1679419','41531','16','Talking''Call time','Sep 5 2017 9:21AM','agent2','3340','Talking' UNION ALL
    SELECT '76','1679370','41486','16','WrapUp''Wrap Time','Sep 5 2017 9:25AM','agent3','3363','WrapUp' UNION ALL
    SELECT '77','1679370','41486','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:26AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '78','1679433','41547','16','Talking''Call time','Sep 5 2017 9:26AM','agent3','3363','Talking' UNION ALL
    SELECT '79','1679419','41531','16','WrapUp''Wrap Time','Sep 5 2017 9:28AM','agent2','3340','WrapUp' UNION ALL
    SELECT '80','1679419','41531','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:29AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '81','1679446','41559','16','Talking''Call time','Sep 5 2017 9:29AM','agent2','3340','Talking' UNION ALL
    SELECT '82','1679448','41561','16','Talking''Call time','Sep 5 2017 9:29AM','agent1','3338','Talking' UNION ALL
    SELECT '83','1679448','41561','16','Hold''Hold','Sep 5 2017 9:30AM','agent1','3338','Hold' UNION ALL
    SELECT '84','1679448','41561','16','WrapUp''Wrap Time','Sep 5 2017 9:30AM','agent1','3338','WrapUp' UNION ALL
    SELECT '85','1679448','41561','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:30AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '86','1679446','41559','16','Hold''Hold','Sep 5 2017 9:35AM','agent2','3340','Hold' UNION ALL
    SELECT '87','1679446','41559','16','Talking''Call time','Sep 5 2017 9:39AM','agent2','3340','Talking' UNION ALL
    SELECT '88','1679433','41547','16','WrapUp''Wrap Time','Sep 5 2017 9:42AM','agent3','3363','WrapUp' UNION ALL
    SELECT '89','1679433','41547','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:43AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '90','1679489','41600','16','Talking''Call time','Sep 5 2017 9:43AM','agent3','3363','Talking' UNION ALL
    SELECT '91','1679446','41559','16','WrapUp''Wrap Time','Sep 5 2017 9:46AM','agent2','3340','WrapUp' UNION ALL
    SELECT '92','1679489','41600','16','WrapUp''Wrap Time','Sep 5 2017 9:46AM','agent3','3363','WrapUp' UNION ALL
    SELECT '93','1679446','41559','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:46AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '94','1679500','41612','16','Talking''Call time','Sep 5 2017 9:46AM','agent2','3340','Talking' UNION ALL
    SELECT '95','1679489','41600','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:47AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '96','1679504','41616','16','Talking''Call time','Sep 5 2017 9:47AM','agent3','3363','Talking' UNION ALL
    SELECT '97','1679504','41616','16','WrapUp''Wrap Time','Sep 5 2017 9:51AM','agent3','3363','WrapUp' UNION ALL
    SELECT '98','1679504','41616','16','InteractionComplete''Interaction Complete','Sep 5 2017 9:51AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '99','1679519','41631','16','Talking''Call time','Sep 5 2017 9:51AM','agent3','3363','Talking' UNION ALL
    SELECT '100','1679500','41612','16','Hold''Hold','Sep 5 2017 9:55AM','agent2','3340','Hold' UNION ALL
    SELECT '101','1679500','41612','16','Talking''Call time','Sep 5 2017 9:56AM','agent2','3340','Talking' UNION ALL
    SELECT '102','1679500','41612','16','WrapUp''Wrap Time','Sep 5 2017 9:58AM','agent2','3340','WrapUp' UNION ALL
    SELECT '103','1679519','41631','16','WrapUp''Wrap Time','Sep 5 2017 9:59AM','agent3','3363','WrapUp' UNION ALL
    SELECT '104','1679519','41631','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:00AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '105','1679540','41652','16','Talking''Call time','Sep 5 2017 10:00AM','agent3','3363','Talking' UNION ALL
    SELECT '106','1679540','41652','16','WrapUp''Wrap Time','Sep 5 2017 10:01AM','agent3','3363','WrapUp' UNION ALL
    SELECT '107','1679540','41652','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:02AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '108','1679550','41662','16','Talking''Call time','Sep 5 2017 10:02AM','agent3','3363','Talking' UNION ALL
    SELECT '109','1679559','41672','16','Talking''Call time','Sep 5 2017 10:06AM','agent1','3338','Talking' UNION ALL
    SELECT '110','1679559','41672','16','Hold''Hold','Sep 5 2017 10:08AM','agent1','3338','Hold' UNION ALL
    SELECT '111','1679559','41672','16','WrapUp''Wrap Time','Sep 5 2017 10:11AM','agent1','3338','WrapUp' UNION ALL
    SELECT '112','1679559','41672','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:11AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '113','1679575','41686','16','Talking''Call time','Sep 5 2017 10:11AM','agent1','3338','Talking' UNION ALL
    SELECT '114','1679575','41686','16','WrapUp''Wrap Time','Sep 5 2017 10:12AM','agent1','3338','WrapUp' UNION ALL
    SELECT '115','1679575','41686','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:12AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '116','1679578','41689','16','Talking''Call time','Sep 5 2017 10:12AM','agent1','3338','Talking' UNION ALL
    SELECT '117','1679578','41689','16','WrapUp''Wrap Time','Sep 5 2017 10:13AM','agent1','3338','WrapUp' UNION ALL
    SELECT '118','1679578','41689','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:13AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '119','1679584','41695','16','Talking''Call time','Sep 5 2017 10:13AM','agent1','3338','Talking' UNION ALL
    SELECT '120','1679500','41612','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:04AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '121','1679587','41698','16','Talking''Call time','Sep 5 2017 10:14AM','agent2','3340','Talking' UNION ALL
    SELECT '122','1679584','41695','16','WrapUp''Wrap Time','Sep 5 2017 10:17AM','agent1','3338','WrapUp' UNION ALL
    SELECT '123','1679584','41695','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:17AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '124','1679600','41712','16','Talking''Call time','Sep 5 2017 10:17AM','agent1','3338','Talking' UNION ALL
    SELECT '125','1679600','41712','16','Hold''Hold','Sep 5 2017 10:21AM','agent1','3338','Hold' UNION ALL
    SELECT '126','1679587','41698','16','WrapUp''Wrap Time','Sep 5 2017 10:22AM','agent2','3340','WrapUp' UNION ALL
    SELECT '127','1679587','41698','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:22AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '128','1679615','41728','16','Talking''Call time','Sep 5 2017 10:22AM','agent2','3340','Talking' UNION ALL
    SELECT '129','1679600','41712','16','Talking''Call time','Sep 5 2017 10:24AM','agent1','3338','Talking' UNION ALL
    SELECT '130','1679600','41712','16','Hold''Hold','Sep 5 2017 10:24AM','agent1','3338','Hold' UNION ALL
    SELECT '131','1679615','41728','16','Hold''Hold','Sep 5 2017 10:25AM','agent2','3340','Hold' UNION ALL
    SELECT '132','1679615','41728','16','WrapUp''Wrap Time','Sep 5 2017 10:25AM','agent2','3340','WrapUp' UNION ALL
    SELECT '133','1679600','41712','16','Talking''Call time','Sep 5 2017 10:25AM','agent1','3338','Talking' UNION ALL
    SELECT '134','1679600','41712','16','Hold''Hold','Sep 5 2017 10:26AM','agent1','3338','Hold' UNION ALL
    SELECT '135','1679615','41728','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:28AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '136','1679634','41745','16','Talking''Call time','Sep 5 2017 10:28AM','agent2','3340','Talking' UNION ALL
    SELECT '137','1679600','41712','16','Talking''Call time','Sep 5 2017 10:32AM','agent1','3338','Talking' UNION ALL
    SELECT '138','1679550','41662','16','WrapUp''Wrap Time','Sep 5 2017 10:33AM','agent3','3363','WrapUp' UNION ALL
    SELECT '139','1679550','41662','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:34AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '140','1679656','41768','16','Talking''Call time','Sep 5 2017 10:34AM','agent3','3363','Talking' UNION ALL
    SELECT '141','1679656','41768','16','WrapUp''Wrap Time','Sep 5 2017 10:37AM','agent3','3363','WrapUp' UNION ALL
    SELECT '142','1679656','41768','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:37AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '143','1679664','41776','16','Talking''Call time','Sep 5 2017 10:37AM','agent3','3363','Talking' UNION ALL
    SELECT '144','1679600','41712','16','Hold''Hold','Sep 5 2017 10:37AM','agent1','3338','Hold' UNION ALL
    SELECT '145','1679600','41712','16','Talking''Call time','Sep 5 2017 10:39AM','agent1','3338','Talking' UNION ALL
    SELECT '146','1679634','41745','16','WrapUp''Wrap Time','Sep 5 2017 10:46AM','agent2','3340','WrapUp' UNION ALL
    SELECT '147','1679600','41712','16','Hold''Hold','Sep 5 2017 10:46AM','agent1','3338','Hold' UNION ALL
    SELECT '148','1679634','41745','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:47AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '149','1679696','41810','16','Talking''Call time','Sep 5 2017 10:47AM','agent2','3340','Talking' UNION ALL
    SELECT '150','1679664','41776','16','WrapUp''Wrap Time','Sep 5 2017 10:47AM','agent3','3363','WrapUp' UNION ALL
    SELECT '151','1679664','41776','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:48AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '152','1679701','41816','16','Talking''Call time','Sep 5 2017 10:48AM','agent3','3363','Talking' UNION ALL
    SELECT '153','1679600','41712','16','Talking''Call time','Sep 5 2017 10:49AM','agent1','3338','Talking' UNION ALL
    SELECT '154','1679600','41712','16','Hold''Hold','Sep 5 2017 10:49AM','agent1','3338','Hold' UNION ALL
    SELECT '155','1679696','41810','16','WrapUp''Wrap Time','Sep 5 2017 10:53AM','agent2','3340','WrapUp' UNION ALL
    SELECT '156','1679600','41712','16','Talking''Call time','Sep 5 2017 10:54AM','agent1','3338','Talking' UNION ALL
    SELECT '157','1679600','41712','16','Hold''Hold','Sep 5 2017 10:55AM','agent1','3338','Hold' UNION ALL
    SELECT '158','1679701','41816','16','WrapUp''Wrap Time','Sep 5 2017 10:55AM','agent3','3363','WrapUp' UNION ALL
    SELECT '159','1679701','41816','16','InteractionComplete''Interaction Complete','Sep 5 2017 10:55AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '160','1679727','41843','16','Talking''Call time','Sep 5 2017 10:55AM','agent3','3363','Talking' UNION ALL
    SELECT '161','1679600','41712','16','Talking''Call time','Sep 5 2017 10:56AM','agent1','3338','Talking' UNION ALL
    SELECT '162','1679600','41712','16','WrapUp''Wrap Time','Sep 5 2017 11:00AM','agent1','3338','WrapUp' UNION ALL
    SELECT '163','1679600','41712','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:00AM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '164','1679696','41810','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:02AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '165','1679755','41870','16','Talking''Call time','Sep 5 2017 11:02AM','agent2','3340','Talking' UNION ALL
    SELECT '166','1679755','41870','16','WrapUp''Wrap Time','Sep 5 2017 11:04AM','agent2','3340','WrapUp' UNION ALL
    SELECT '167','1679755','41870','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:04AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '168','1679765','41880','16','Talking''Call time','Sep 5 2017 11:04AM','agent2','3340','Talking' UNION ALL
    SELECT '169','1679727','41843','16','WrapUp''Wrap Time','Sep 5 2017 11:08AM','agent3','3363','WrapUp' UNION ALL
    SELECT '170','1679727','41843','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:08AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '171','1679783','41899','16','Talking''Call time','Sep 5 2017 11:08AM','agent3','3363','Talking' UNION ALL
    SELECT '172','1679783','41899','16','WrapUp''Wrap Time','Sep 5 2017 11:09AM','agent3','3363','WrapUp' UNION ALL
    SELECT '173','1679783','41899','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:09AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '174','1679788','41903','16','Talking''Call time','Sep 5 2017 11:10AM','agent3','3363','Talking' UNION ALL
    SELECT '175','1679765','41880','16','WrapUp''Wrap Time','Sep 5 2017 11:13AM','agent2','3340','WrapUp' UNION ALL
    SELECT '176','1679765','41880','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:14AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '177','1679805','41920','16','Talking''Call time','Sep 5 2017 11:14AM','agent2','3340','Talking' UNION ALL
    SELECT '178','1679805','41920','16','Hold''Hold','Sep 5 2017 11:17AM','agent2','3340','Hold' UNION ALL
    SELECT '179','1679805','41920','16','Talking''Call time','Sep 5 2017 11:19AM','agent2','3340','Talking' UNION ALL
    SELECT '180','1679805','41920','16','Hold''Hold','Sep 5 2017 11:19AM','agent2','3340','Hold' UNION ALL
    SELECT '181','1679788','41903','16','WrapUp''Wrap Time','Sep 5 2017 11:21AM','agent3','3363','WrapUp' UNION ALL
    SELECT '182','1679788','41903','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:21AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '183','1679805','41920','16','WrapUp''Wrap Time','Sep 5 2017 11:21AM','agent2','3340','WrapUp' UNION ALL
    SELECT '184','1679805','41920','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:22AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '185','1679831','41945','16','Talking''Call time','Sep 5 2017 11:22AM','agent2','3340','Talking' UNION ALL
    SELECT '186','1679831','41945','16','Hold''Hold','Sep 5 2017 11:28AM','agent2','3340','Hold' UNION ALL
    SELECT '187','1679831','41945','16','Talking''Call time','Sep 5 2017 11:31AM','agent2','3340','Talking' UNION ALL
    SELECT '188','1679831','41945','16','WrapUp''Wrap Time','Sep 5 2017 11:34AM','agent2','3340','WrapUp' UNION ALL
    SELECT '189','1679831','41945','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:34AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '190','1679876','41991','16','Talking''Call time','Sep 5 2017 11:34AM','agent2','3340','Talking' UNION ALL
    SELECT '191','1679876','41991','16','WrapUp''Wrap Time','Sep 5 2017 11:36AM','agent2','3340','WrapUp' UNION ALL
    SELECT '192','1679876','41991','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:36AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '193','1679878','41992','16','Talking''Call time','Sep 5 2017 11:36AM','agent2','3340','Talking' UNION ALL
    SELECT '194','1679879','41993','16','Talking''Call time','Sep 5 2017 11:36AM','agent3','3363','Talking' UNION ALL
    SELECT '195','1679879','41993','16','Hold''Hold','Sep 5 2017 11:38AM','agent3','3363','Hold' UNION ALL
    SELECT '196','1679879','41993','16','WrapUp''Wrap Time','Sep 5 2017 11:39AM','agent3','3363','WrapUp' UNION ALL
    SELECT '197','1679879','41993','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:39AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '198','1679891','42004','16','Talking''Call time','Sep 5 2017 11:39AM','agent3','3363','Talking' UNION ALL
    SELECT '199','1679878','41992','16','WrapUp''Wrap Time','Sep 5 2017 11:41AM','agent2','3340','WrapUp' UNION ALL
    SELECT '200','1679878','41992','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:43AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '201','1679902','42015','16','Talking''Call time','Sep 5 2017 11:43AM','agent2','3340','Talking' UNION ALL
    SELECT '202','1679891','42004','16','WrapUp''Wrap Time','Sep 5 2017 11:44AM','agent3','3363','WrapUp' UNION ALL
    SELECT '203','1679891','42004','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:44AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '204','1679907','42020','16','Talking''Call time','Sep 5 2017 11:44AM','agent3','3363','Talking' UNION ALL
    SELECT '205','1679902','42015','16','WrapUp''Wrap Time','Sep 5 2017 11:46AM','agent2','3340','WrapUp' UNION ALL
    SELECT '206','1679902','42015','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:46AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '207','1679910','42023','16','Talking''Call time','Sep 5 2017 11:46AM','agent2','3340','Talking' UNION ALL
    SELECT '208','1679907','42020','16','WrapUp''Wrap Time','Sep 5 2017 11:49AM','agent3','3363','WrapUp' UNION ALL
    SELECT '209','1679907','42020','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:50AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '210','1679921','42034','16','Talking''Call time','Sep 5 2017 11:50AM','agent3','3363','Talking' UNION ALL
    SELECT '211','1679921','42034','16','WrapUp''Wrap Time','Sep 5 2017 11:51AM','agent3','3363','WrapUp' UNION ALL
    SELECT '212','1679921','42034','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:51AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '213','1679923','42036','16','Talking''Call time','Sep 5 2017 11:51AM','agent3','3363','Talking' UNION ALL
    SELECT '214','1679923','42036','16','WrapUp''Wrap Time','Sep 5 2017 11:54AM','agent3','3363','WrapUp' UNION ALL
    SELECT '215','1679923','42036','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:55AM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '216','1679935','42048','16','Talking''Call time','Sep 5 2017 11:55AM','agent3','3363','Talking' UNION ALL
    SELECT '217','1679910','42023','16','WrapUp''Wrap Time','Sep 5 2017 11:56AM','agent2','3340','WrapUp' UNION ALL
    SELECT '218','1679910','42023','16','InteractionComplete''Interaction Complete','Sep 5 2017 11:56AM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '219','1679940','42053','16','Talking''Call time','Sep 5 2017 11:56AM','agent2','3340','Talking' UNION ALL
    SELECT '220','1679940','42053','16','Hold''Hold','Sep 5 2017 12:03PM','agent2','3340','Hold' UNION ALL
    SELECT '221','1679935','42048','16','WrapUp''Wrap Time','Sep 5 2017 12:03PM','agent3','3363','WrapUp' UNION ALL
    SELECT '222','1679935','42048','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:04PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '223','1679953','42068','16','Talking''Call time','Sep 5 2017 12:04PM','agent3','3363','Talking' UNION ALL
    SELECT '224','1679940','42053','16','WrapUp''Wrap Time','Sep 5 2017 12:04PM','agent2','3340','WrapUp' UNION ALL
    SELECT '225','1679940','42053','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:05PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '226','1679955','42070','16','Talking''Call time','Sep 5 2017 12:05PM','agent2','3340','Talking' UNION ALL
    SELECT '227','1679955','42070','16','WrapUp''Wrap Time','Sep 5 2017 12:07PM','agent2','3340','WrapUp' UNION ALL
    SELECT '228','1679955','42070','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:07PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '229','1679964','42079','16','Talking''Call time','Sep 5 2017 12:07PM','agent2','3340','Talking' UNION ALL
    SELECT '230','1679953','42068','16','WrapUp''Wrap Time','Sep 5 2017 12:11PM','agent3','3363','WrapUp' UNION ALL
    SELECT '231','1679953','42068','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:11PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '232','1679977','42093','16','Talking''Call time','Sep 5 2017 12:11PM','agent3','3363','Talking' UNION ALL
    SELECT '233','1679964','42079','16','Hold''Hold','Sep 5 2017 12:12PM','agent2','3340','Hold' UNION ALL
    SELECT '234','1679977','42093','16','Hold''Hold','Sep 5 2017 12:12PM','agent3','3363','Hold' UNION ALL
    SELECT '235','1679982','42098','16','Talking''Call time','Sep 5 2017 12:12PM','agent1','3338','Talking' UNION ALL
    SELECT '236','1679977','42093','16','WrapUp''Wrap Time','Sep 5 2017 12:13PM','agent3','3363','WrapUp' UNION ALL
    SELECT '237','1679977','42093','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:13PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '238','1679983','42099','16','Talking''Call time','Sep 5 2017 12:13PM','agent3','3363','Talking' UNION ALL
    SELECT '239','1679964','42079','16','Talking''Call time','Sep 5 2017 12:14PM','agent2','3340','Talking' UNION ALL
    SELECT '240','1679982','42098','16','WrapUp''Wrap Time','Sep 5 2017 12:15PM','agent1','3338','WrapUp' UNION ALL
    SELECT '241','1679982','42098','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:15PM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '242','1679983','42099','16','WrapUp''Wrap Time','Sep 5 2017 12:19PM','agent3','3363','WrapUp' UNION ALL
    SELECT '243','1679983','42099','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:20PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '244','1680001','42117','16','Talking''Call time','Sep 5 2017 12:20PM','agent3','3363','Talking' UNION ALL
    SELECT '245','1679964','42079','16','WrapUp''Wrap Time','Sep 5 2017 12:23PM','agent2','3340','WrapUp' UNION ALL
    SELECT '246','1679964','42079','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:23PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '247','1680001','42117','16','Hold''Hold','Sep 5 2017 12:26PM','agent3','3363','Hold' UNION ALL
    SELECT '248','1680001','42117','16','WrapUp''Wrap Time','Sep 5 2017 12:26PM','agent3','3363','WrapUp' UNION ALL
    SELECT '249','1680001','42117','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:27PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '250','1680030','42146','16','Talking''Call time','Sep 5 2017 12:27PM','agent3','3363','Talking' UNION ALL
    SELECT '251','1680030','42146','16','WrapUp''Wrap Time','Sep 5 2017 12:29PM','agent3','3363','WrapUp' UNION ALL
    SELECT '252','1680030','42146','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:30PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '253','1680039','42155','16','Talking''Call time','Sep 5 2017 12:30PM','agent3','3363','Talking' UNION ALL
    SELECT '254','1680039','42155','16','WrapUp''Wrap Time','Sep 5 2017 12:34PM','agent3','3363','WrapUp' UNION ALL
    SELECT '255','1680039','42155','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:35PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '256','1680055','42171','16','Talking''Call time','Sep 5 2017 12:35PM','agent3','3363','Talking' UNION ALL
    SELECT '257','1680055','42171','16','Hold''Hold','Sep 5 2017 12:37PM','agent3','3363','Hold' UNION ALL
    SELECT '258','1680055','42171','16','WrapUp''Wrap Time','Sep 5 2017 12:39PM','agent3','3363','WrapUp' UNION ALL
    SELECT '259','1680055','42171','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:40PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '260','1680072','42191','16','Talking''Call time','Sep 5 2017 12:40PM','agent3','3363','Talking' UNION ALL
    SELECT '261','1680072','42191','16','WrapUp''Wrap Time','Sep 5 2017 12:47PM','agent3','3363','WrapUp' UNION ALL
    SELECT '262','1680072','42191','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:48PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '263','1680105','42225','16','Talking''Call time','Sep 5 2017 12:48PM','agent3','3363','Talking' UNION ALL
    SELECT '264','1680105','42225','16','WrapUp''Wrap Time','Sep 5 2017 12:52PM','agent3','3363','WrapUp' UNION ALL
    SELECT '265','1680105','42225','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:53PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '266','1680121','42241','16','Talking''Call time','Sep 5 2017 12:53PM','agent3','3363','Talking' UNION ALL
    SELECT '267','1680128','42247','16','Talking''Call time','Sep 5 2017 12:54PM','agent2','3340','Talking' UNION ALL
    SELECT '268','1680128','42247','16','WrapUp''Wrap Time','Sep 5 2017 12:57PM','agent2','3340','WrapUp' UNION ALL
    SELECT '269','1680128','42247','16','InteractionComplete''Interaction Complete','Sep 5 2017 12:57PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '270','1680135','42254','16','Talking''Call time','Sep 5 2017 12:57PM','agent2','3340','Talking' UNION ALL
    SELECT '271','1680121','42241','16','WrapUp''Wrap Time','Sep 5 2017 12:59PM','agent3','3363','WrapUp' UNION ALL
    SELECT '272','1680121','42241','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:00PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '273','1680149','42268','16','Talking''Call time','Sep 5 2017 1:00PM','agent3','3363','Talking' UNION ALL
    SELECT '274','1680149','42268','16','WrapUp''Wrap Time','Sep 5 2017 1:04PM','agent3','3363','WrapUp' UNION ALL
    SELECT '275','1680149','42268','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:05PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '276','1680166','42285','16','Talking''Call time','Sep 5 2017 1:05PM','agent3','3363','Talking' UNION ALL
    SELECT '277','1680135','42254','16','Hold''Hold','Sep 5 2017 1:05PM','agent2','3340','Hold' UNION ALL
    SELECT '278','1680166','42285','16','Hold''Hold','Sep 5 2017 1:07PM','agent3','3363','Hold' UNION ALL
    SELECT '279','1680135','42254','16','Talking''Call time','Sep 5 2017 1:08PM','agent2','3340','Talking' UNION ALL
    SELECT '280','1680166','42285','16','WrapUp''Wrap Time','Sep 5 2017 1:08PM','agent3','3363','WrapUp' UNION ALL
    SELECT '281','1680166','42285','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:09PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '282','1680184','42304','16','Talking''Call time','Sep 5 2017 1:09PM','agent3','3363','Talking' UNION ALL
    SELECT '283','1680135','42254','16','Hold''Hold','Sep 5 2017 1:11PM','agent2','3340','Hold' UNION ALL
    SELECT '284','1680135','42254','16','Talking''Call time','Sep 5 2017 1:13PM','agent2','3340','Talking' UNION ALL
    SELECT '285','1680184','42304','16','WrapUp''Wrap Time','Sep 5 2017 1:13PM','agent3','3363','WrapUp' UNION ALL
    SELECT '286','1680135','42254','16','WrapUp''Wrap Time','Sep 5 2017 1:13PM','agent2','3340','WrapUp' UNION ALL
    SELECT '287','1680135','42254','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:13PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '288','1680201','42320','16','Talking''Call time','Sep 5 2017 1:13PM','agent2','3340','Talking' UNION ALL
    SELECT '289','1680184','42304','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:13PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '290','1680202','42321','16','Talking''Call time','Sep 5 2017 1:13PM','agent3','3363','Talking' UNION ALL
    SELECT '291','1680202','42321','16','WrapUp''Wrap Time','Sep 5 2017 1:17PM','agent3','3363','WrapUp' UNION ALL
    SELECT '292','1680202','42321','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:18PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '293','1680223','42342','16','Talking''Call time','Sep 5 2017 1:18PM','agent3','3363','Talking' UNION ALL
    SELECT '294','1680201','42320','16','WrapUp''Wrap Time','Sep 5 2017 1:19PM','agent2','3340','WrapUp' UNION ALL
    SELECT '295','1680201','42320','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:19PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '296','1680225','42344','16','Talking''Call time','Sep 5 2017 1:19PM','agent2','3340','Talking' UNION ALL
    SELECT '297','1680225','42344','16','Hold''Hold','Sep 5 2017 1:21PM','agent2','3340','Hold' UNION ALL
    SELECT '298','1680225','42344','16','Talking''Call time','Sep 5 2017 1:23PM','agent2','3340','Talking' UNION ALL
    SELECT '299','1680225','42344','16','Hold''Hold','Sep 5 2017 1:23PM','agent2','3340','Hold' UNION ALL
    SELECT '300','1680225','42344','16','Talking''Call time','Sep 5 2017 1:24PM','agent2','3340','Talking' UNION ALL
    SELECT '301','1680250','42371','16','Talking''Call time','Sep 5 2017 1:27PM','agent1','3338','Talking' UNION ALL
    SELECT '302','1680225','42344','16','WrapUp''Wrap Time','Sep 5 2017 1:29PM','agent2','3340','WrapUp' UNION ALL
    SELECT '303','1680250','42371','16','WrapUp''Wrap Time','Sep 5 2017 1:30PM','agent1','3338','WrapUp' UNION ALL
    SELECT '304','1680250','42371','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:30PM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '305','1680225','42344','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:31PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '306','1681927','42387','16','Talking''Call time','Sep 5 2017 1:31PM','agent2','3340','Talking' UNION ALL
    SELECT '307','1680223','42342','16','WrapUp''Wrap Time','Sep 5 2017 1:32PM','agent3','3363','WrapUp' UNION ALL
    SELECT '308','1680223','42342','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:33PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '309','1681935','42397','16','Talking''Call time','Sep 5 2017 1:33PM','agent3','3363','Talking' UNION ALL
    SELECT '310','1681935','42397','16','WrapUp''Wrap Time','Sep 5 2017 1:37PM','agent3','3363','WrapUp' UNION ALL
    SELECT '311','1681935','42397','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:38PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '312','1681953','42414','16','Talking''Call time','Sep 5 2017 1:38PM','agent3','3363','Talking' UNION ALL
    SELECT '313','1681927','42387','16','WrapUp''Wrap Time','Sep 5 2017 1:40PM','agent2','3340','WrapUp' UNION ALL
    SELECT '314','1681927','42387','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:40PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '315','1681958','42419','16','Talking''Call time','Sep 5 2017 1:40PM','agent2','3340','Talking' UNION ALL
    SELECT '316','1681953','42414','16','Hold''Hold','Sep 5 2017 1:41PM','agent3','3363','Hold' UNION ALL
    SELECT '317','1681953','42414','16','WrapUp''Wrap Time','Sep 5 2017 1:42PM','agent3','3363','WrapUp' UNION ALL
    SELECT '318','1681953','42414','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:43PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '319','1681965','42427','16','Talking''Call time','Sep 5 2017 1:43PM','agent3','3363','Talking' UNION ALL
    SELECT '320','1681965','42427','16','WrapUp''Wrap Time','Sep 5 2017 1:46PM','agent3','3363','WrapUp' UNION ALL
    SELECT '321','1681965','42427','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:46PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '322','1681979','42439','16','Talking''Call time','Sep 5 2017 1:47PM','agent3','3363','Talking' UNION ALL
    SELECT '323','1681958','42419','16','WrapUp''Wrap Time','Sep 5 2017 1:50PM','agent2','3340','WrapUp' UNION ALL
    SELECT '324','1681958','42419','16','InteractionComplete''Interaction Complete','Sep 5 2017 1:50PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '325','1684483','42460','16','Talking''Call time','Sep 5 2017 1:51PM','agent2','3340','Talking' UNION ALL
    SELECT '326','1684483','42460','16','Hold''Hold','Sep 5 2017 1:53PM','agent2','3340','Hold' UNION ALL
    SELECT '327','1684483','42460','16','WrapUp''Wrap Time','Sep 5 2017 1:55PM','agent2','3340','WrapUp' UNION ALL
    SELECT '328','1681979','42439','16','WrapUp''Wrap Time','Sep 5 2017 2:05PM','agent3','3363','WrapUp' UNION ALL
    SELECT '329','1681979','42439','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:06PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '330','1684483','42460','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:01PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '331','1706599','42581','16','Talking''Call time','Sep 5 2017 2:30PM','agent2','3340','Talking' UNION ALL
    SELECT '332','1706613','42593','16','Talking''Call time','Sep 5 2017 2:33PM','agent3','3363','Talking' UNION ALL
    SELECT '333','1706599','42581','16','WrapUp''Wrap Time','Sep 5 2017 2:34PM','agent2','3340','WrapUp' UNION ALL
    SELECT '334','1706599','42581','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:34PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '335','1706617','42597','16','Talking''Call time','Sep 5 2017 2:34PM','agent2','3340','Talking' UNION ALL
    SELECT '336','1706613','42593','16','Hold''Hold','Sep 5 2017 2:35PM','agent3','3363','Hold' UNION ALL
    SELECT '337','1706613','42593','16','WrapUp''Wrap Time','Sep 5 2017 2:36PM','agent3','3363','WrapUp' UNION ALL
    SELECT '338','1706613','42593','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:36PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '339','1706630','42609','16','Talking''Call time','Sep 5 2017 2:36PM','agent3','3363','Talking' UNION ALL
    SELECT '340','1706630','42609','16','WrapUp''Wrap Time','Sep 5 2017 2:39PM','agent3','3363','WrapUp' UNION ALL
    SELECT '341','1706630','42609','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:39PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '342','1706644','42627','16','Talking''Call time','Sep 5 2017 2:40PM','agent3','3363','Talking' UNION ALL
    SELECT '343','1706647','42630','16','Talking''Call time','Sep 5 2017 2:40PM','agent1','3338','Talking' UNION ALL
    SELECT '344','1706644','42627','16','WrapUp''Wrap Time','Sep 5 2017 2:41PM','agent3','3363','WrapUp' UNION ALL
    SELECT '345','1706644','42627','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:41PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '346','1706650','42635','16','Talking''Call time','Sep 5 2017 2:41PM','agent3','3363','Talking' UNION ALL
    SELECT '347','1706647','42630','16','WrapUp''Wrap Time','Sep 5 2017 2:44PM','agent1','3338','WrapUp' UNION ALL
    SELECT '348','1706647','42630','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:45PM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '349','1706617','42597','16','WrapUp''Wrap Time','Sep 5 2017 2:46PM','agent2','3340','WrapUp' UNION ALL
    SELECT '350','1706650','42635','16','WrapUp''Wrap Time','Sep 5 2017 2:46PM','agent3','3363','WrapUp' UNION ALL
    SELECT '351','1706617','42597','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:47PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '352','1706650','42635','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:47PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '353','1706675','42658','16','Talking''Call time','Sep 5 2017 2:47PM','agent2','3340','Talking' UNION ALL
    SELECT '354','1706676','42659','16','Talking''Call time','Sep 5 2017 2:47PM','agent3','3363','Talking' UNION ALL
    SELECT '355','1706675','42658','16','Hold''Hold','Sep 5 2017 2:50PM','agent2','3340','Hold' UNION ALL
    SELECT '356','1706676','42659','16','WrapUp''Wrap Time','Sep 5 2017 2:51PM','agent3','3363','WrapUp' UNION ALL
    SELECT '357','1706676','42659','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:52PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '358','1706693','42675','16','Talking''Call time','Sep 5 2017 2:52PM','agent3','3363','Talking' UNION ALL
    SELECT '359','1706675','42658','16','WrapUp''Wrap Time','Sep 5 2017 2:52PM','agent2','3340','WrapUp' UNION ALL
    SELECT '360','1706675','42658','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:53PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '361','1706699','42681','16','Talking''Call time','Sep 5 2017 2:53PM','agent2','3340','Talking' UNION ALL
    SELECT '362','1706693','42675','16','Hold''Hold','Sep 5 2017 2:54PM','agent3','3363','Hold' UNION ALL
    SELECT '363','1706693','42675','16','WrapUp''Wrap Time','Sep 5 2017 2:55PM','agent3','3363','WrapUp' UNION ALL
    SELECT '364','1706693','42675','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:55PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '365','1706708','42690','16','Talking''Call time','Sep 5 2017 2:55PM','agent3','3363','Talking' UNION ALL
    SELECT '366','1706699','42681','16','Hold''Hold','Sep 5 2017 2:56PM','agent2','3340','Hold' UNION ALL
    SELECT '367','1706708','42690','16','Hold''Hold','Sep 5 2017 2:57PM','agent3','3363','Hold' UNION ALL
    SELECT '368','1706699','42681','16','WrapUp''Wrap Time','Sep 5 2017 2:57PM','agent2','3340','WrapUp' UNION ALL
    SELECT '369','1706699','42681','16','InteractionComplete''Interaction Complete','Sep 5 2017 2:58PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '370','1706716','42698','16','Talking''Call time','Sep 5 2017 2:58PM','agent2','3340','Talking' UNION ALL
    SELECT '371','1706708','42690','16','Talking''Call time','Sep 5 2017 3:01PM','agent3','3363','Talking' UNION ALL
    SELECT '372','1706708','42690','16','WrapUp''Wrap Time','Sep 5 2017 3:07PM','agent3','3363','WrapUp' UNION ALL
    SELECT '373','1706708','42690','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:08PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '374','1706755','42738','16','Talking''Call time','Sep 5 2017 3:08PM','agent3','3363','Talking' UNION ALL
    SELECT '375','1706716','42698','16','WrapUp''Wrap Time','Sep 5 2017 3:11PM','agent2','3340','WrapUp' UNION ALL
    SELECT '376','1706755','42738','16','WrapUp''Wrap Time','Sep 5 2017 3:17PM','agent3','3363','WrapUp' UNION ALL
    SELECT '377','1706755','42738','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:17PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '378','1706790','42773','16','Talking''Call time','Sep 5 2017 3:18PM','agent3','3363','Talking' UNION ALL
    SELECT '379','1706806','42789','16','Talking''Call time','Sep 5 2017 3:21PM','agent1','3338','Talking' UNION ALL
    SELECT '380','1706806','42789','16','Hold''Hold','Sep 5 2017 3:27PM','agent1','3338','Hold' UNION ALL
    SELECT '381','1706716','42698','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:12PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '382','1706790','42773','16','WrapUp''Wrap Time','Sep 5 2017 3:28PM','agent3','3363','WrapUp' UNION ALL
    SELECT '383','1706823','42806','16','Talking''Call time','Sep 5 2017 3:28PM','agent2','3340','Talking' UNION ALL
    SELECT '384','1706790','42773','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:28PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '385','1706825','42808','16','Talking''Call time','Sep 5 2017 3:28PM','agent3','3363','Talking' UNION ALL
    SELECT '386','1706806','42789','16','Talking''Call time','Sep 5 2017 3:31PM','agent1','3338','Talking' UNION ALL
    SELECT '387','1706806','42789','16','Hold''Hold','Sep 5 2017 3:31PM','agent1','3338','Hold' UNION ALL
    SELECT '388','1706806','42789','16','Talking''Call time','Sep 5 2017 3:33PM','agent1','3338','Talking' UNION ALL
    SELECT '389','1706806','42789','16','WrapUp''Wrap Time','Sep 5 2017 3:35PM','agent1','3338','WrapUp' UNION ALL
    SELECT '390','1706806','42789','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:35PM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '391','1706825','42808','16','WrapUp''Wrap Time','Sep 5 2017 3:38PM','agent3','3363','WrapUp' UNION ALL
    SELECT '392','1706825','42808','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:39PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '393','1706853','42836','16','Talking''Call time','Sep 5 2017 3:39PM','agent3','3363','Talking' UNION ALL
    SELECT '394','1706823','42806','16','WrapUp''Wrap Time','Sep 5 2017 3:42PM','agent2','3340','WrapUp' UNION ALL
    SELECT '395','1706823','42806','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:42PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '396','1706871','42854','16','Talking''Call time','Sep 5 2017 3:44PM','agent2','3340','Talking' UNION ALL
    SELECT '397','1706874','42857','16','Talking''Call time','Sep 5 2017 3:44PM','agent1','3338','Talking' UNION ALL
    SELECT '398','1706874','42857','16','Hold''Hold','Sep 5 2017 3:46PM','agent1','3338','Hold' UNION ALL
    SELECT '399','1706874','42857','16','Talking''Call time','Sep 5 2017 3:49PM','agent1','3338','Talking' UNION ALL
    SELECT '400','1706874','42857','16','Hold''Hold','Sep 5 2017 3:49PM','agent1','3338','Hold' UNION ALL
    SELECT '401','1706874','42857','16','WrapUp''Wrap Time','Sep 5 2017 3:50PM','agent1','3338','WrapUp' UNION ALL
    SELECT '402','1706871','42854','16','WrapUp''Wrap Time','Sep 5 2017 3:50PM','agent2','3340','WrapUp' UNION ALL
    SELECT '403','1706874','42857','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:50PM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '404','1706871','42854','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:53PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '405','1706904','42890','16','Talking''Call time','Sep 5 2017 3:54PM','agent2','3340','Talking' UNION ALL
    SELECT '406','1706853','42836','16','WrapUp''Wrap Time','Sep 5 2017 3:54PM','agent3','3363','WrapUp' UNION ALL
    SELECT '407','1706853','42836','16','InteractionComplete''Interaction Complete','Sep 5 2017 3:54PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '408','1706904','42890','16','Hold''Hold','Sep 5 2017 4:02PM','agent2','3340','Hold' UNION ALL
    SELECT '409','1706956','42940','16','Talking''Call time','Sep 5 2017 4:03PM','agent1','3338','Talking' UNION ALL
    SELECT '410','1706904','42890','16','Talking''Call time','Sep 5 2017 4:04PM','agent2','3340','Talking' UNION ALL
    SELECT '411','1706904','42890','16','Hold''Hold','Sep 5 2017 4:04PM','agent2','3340','Hold' UNION ALL
    SELECT '412','1706904','42890','16','Talking''Call time','Sep 5 2017 4:05PM','agent2','3340','Talking' UNION ALL
    SELECT '413','1706956','42940','16','WrapUp''Wrap Time','Sep 5 2017 4:07PM','agent1','3338','WrapUp' UNION ALL
    SELECT '414','1706956','42940','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:07PM','agent1','3338','InteractionComplete' UNION ALL
    SELECT '415','1706982','42966','16','Talking''Call time','Sep 5 2017 4:09PM','agent3','3363','Talking' UNION ALL
    SELECT '416','1706982','42966','16','WrapUp''Wrap Time','Sep 5 2017 4:16PM','agent3','3363','WrapUp' UNION ALL
    SELECT '417','1706982','42966','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:16PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '418','1707003','42988','16','Talking''Call time','Sep 5 2017 4:16PM','agent3','3363','Talking' UNION ALL
    SELECT '419','1706904','42890','16','WrapUp''Wrap Time','Sep 5 2017 4:18PM','agent2','3340','WrapUp' UNION ALL
    SELECT '420','1706904','42890','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:18PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '421','1707009','42994','16','Talking''Call time','Sep 5 2017 4:18PM','agent2','3340','Talking' UNION ALL
    SELECT '422','1707003','42988','16','WrapUp''Wrap Time','Sep 5 2017 4:27PM','agent3','3363','WrapUp' UNION ALL
    SELECT '423','1707003','42988','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:27PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '424','1707039','43025','16','Talking''Call time','Sep 5 2017 4:27PM','agent3','3363','Talking' UNION ALL
    SELECT '425','1707039','43025','16','Hold''Hold','Sep 5 2017 4:28PM','agent3','3363','Hold' UNION ALL
    SELECT '426','1707039','43025','16','WrapUp''Wrap Time','Sep 5 2017 4:30PM','agent3','3363','WrapUp' UNION ALL
    SELECT '427','-1','43030','-1','ExitApplication''Application Close','Sep 5 2017 4:30PM','agent1','3338','ExitApplication' UNION ALL
    SELECT '428','1707039','43025','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:30PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '429','1707046','43034','16','Talking''Call time','Sep 5 2017 4:30PM','agent3','3363','Talking' UNION ALL
    SELECT '430','1707009','42994','16','WrapUp''Wrap Time','Sep 5 2017 4:34PM','agent2','3340','WrapUp' UNION ALL
    SELECT '431','1707009','42994','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:35PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '432','1707046','43034','16','WrapUp''Wrap Time','Sep 5 2017 4:35PM','agent3','3363','WrapUp' UNION ALL
    SELECT '433','1707066','43063','16','Talking''Call time','Sep 5 2017 4:35PM','agent2','3340','Talking' UNION ALL
    SELECT '434','1707046','43034','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:36PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '435','1707069','43067','16','Talking''Call time','Sep 5 2017 4:36PM','agent3','3363','Talking' UNION ALL
    SELECT '436','1707066','43063','16','WrapUp''Wrap Time','Sep 5 2017 4:38PM','agent2','3340','WrapUp' UNION ALL
    SELECT '437','1707066','43063','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:39PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '438','1707079','43079','16','Talking''Call time','Sep 5 2017 4:39PM','agent2','3340','Talking' UNION ALL
    SELECT '439','1707069','43067','16','WrapUp''Wrap Time','Sep 5 2017 4:40PM','agent3','3363','WrapUp' UNION ALL
    SELECT '440','1707069','43067','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:42PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '441','1707088','43089','16','Talking''Call time','Sep 5 2017 4:42PM','agent3','3363','Talking' UNION ALL
    SELECT '442','1707079','43079','16','Hold''Hold','Sep 5 2017 4:42PM','agent2','3340','Hold' UNION ALL
    SELECT '443','1707079','43079','16','Talking''Call time','Sep 5 2017 4:45PM','agent2','3340','Talking' UNION ALL
    SELECT '444','1707088','43089','16','WrapUp''Wrap Time','Sep 5 2017 4:45PM','agent3','3363','WrapUp' UNION ALL
    SELECT '445','1707088','43089','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:46PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '446','1707099','43099','16','Talking''Call time','Sep 5 2017 4:46PM','agent3','3363','Talking' UNION ALL
    SELECT '447','1707099','43099','16','WrapUp''Wrap Time','Sep 5 2017 4:49PM','agent3','3363','WrapUp' UNION ALL
    SELECT '448','1707099','43099','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:49PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '449','1707106','43107','16','Talking''Call time','Sep 5 2017 4:49PM','agent3','3363','Talking' UNION ALL
    SELECT '450','1707079','43079','16','WrapUp''Wrap Time','Sep 5 2017 4:52PM','agent2','3340','WrapUp' UNION ALL
    SELECT '451','1707106','43107','16','WrapUp''Wrap Time','Sep 5 2017 4:53PM','agent3','3363','WrapUp' UNION ALL
    SELECT '452','1707106','43107','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:54PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '453','1707122','43123','16','Talking''Call time','Sep 5 2017 4:54PM','agent3','3363','Talking' UNION ALL
    SELECT '454','1707079','43079','16','InteractionComplete''Interaction Complete','Sep 5 2017 4:55PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '455','1707128','43130','16','Talking''Call time','Sep 5 2017 4:56PM','agent2','3340','Talking' UNION ALL
    SELECT '456','1707122','43123','16','WrapUp''Wrap Time','Sep 5 2017 4:59PM','agent3','3363','WrapUp' UNION ALL
    SELECT '457','1707122','43123','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:00PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '458','1707142','43144','16','Talking''Call time','Sep 5 2017 5:00PM','agent3','3363','Talking' UNION ALL
    SELECT '459','1707128','43130','16','Hold''Hold','Sep 5 2017 5:00PM','agent2','3340','Hold' UNION ALL
    SELECT '460','1707128','43130','16','Talking''Call time','Sep 5 2017 5:05PM','agent2','3340','Talking' UNION ALL
    SELECT '461','1707128','43130','16','Hold''Hold','Sep 5 2017 5:05PM','agent2','3340','Hold' UNION ALL
    SELECT '462','1707128','43130','16','Talking''Call time','Sep 5 2017 5:05PM','agent2','3340','Talking' UNION ALL
    SELECT '463','1707142','43144','16','WrapUp''Wrap Time','Sep 5 2017 5:05PM','agent3','3363','WrapUp' UNION ALL
    SELECT '464','1707142','43144','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:06PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '465','1707161','43163','16','Talking''Call time','Sep 5 2017 5:06PM','agent3','3363','Talking' UNION ALL
    SELECT '466','1707128','43130','16','WrapUp''Wrap Time','Sep 5 2017 5:08PM','agent2','3340','WrapUp' UNION ALL
    SELECT '467','1707128','43130','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:08PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '468','1707166','43168','16','Talking''Call time','Sep 5 2017 5:08PM','agent2','3340','Talking' UNION ALL
    SELECT '469','1707161','43163','16','WrapUp''Wrap Time','Sep 5 2017 5:09PM','agent3','3363','WrapUp' UNION ALL
    SELECT '470','1707161','43163','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:09PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '471','1707170','43171','16','Talking''Call time','Sep 5 2017 5:09PM','agent3','3363','Talking' UNION ALL
    SELECT '472','1707166','43168','16','WrapUp''Wrap Time','Sep 5 2017 5:13PM','agent2','3340','WrapUp' UNION ALL
    SELECT '473','1707166','43168','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:13PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '474','1707180','43181','16','Talking''Call time','Sep 5 2017 5:13PM','agent2','3340','Talking' UNION ALL
    SELECT '475','1707180','43181','16','WrapUp''Wrap Time','Sep 5 2017 5:20PM','agent2','3340','WrapUp' UNION ALL
    SELECT '476','1707170','43171','16','WrapUp''Wrap Time','Sep 5 2017 5:20PM','agent3','3363','WrapUp' UNION ALL
    SELECT '477','1707180','43181','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:20PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '478','1707199','43202','16','Talking''Call time','Sep 5 2017 5:21PM','agent2','3340','Talking' UNION ALL
    SELECT '479','1707170','43171','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:21PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '480','1707202','43205','16','Talking''Call time','Sep 5 2017 5:21PM','agent3','3363','Talking' UNION ALL
    SELECT '481','1707202','43205','16','WrapUp''Wrap Time','Sep 5 2017 5:22PM','agent3','3363','WrapUp' UNION ALL
    SELECT '482','1707202','43205','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:22PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '483','1707208','43211','16','Talking''Call time','Sep 5 2017 5:22PM','agent3','3363','Talking' UNION ALL
    SELECT '484','1707199','43202','16','WrapUp''Wrap Time','Sep 5 2017 5:25PM','agent2','3340','WrapUp' UNION ALL
    SELECT '485','1707199','43202','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:25PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '486','1707216','43218','16','Talking''Call time','Sep 5 2017 5:25PM','agent2','3340','Talking' UNION ALL
    SELECT '487','1707208','43211','16','WrapUp''Wrap Time','Sep 5 2017 5:26PM','agent3','3363','WrapUp' UNION ALL
    SELECT '488','1707208','43211','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:26PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '489','1707218','43220','16','Talking''Call time','Sep 5 2017 5:26PM','agent3','3363','Talking' UNION ALL
    SELECT '490','1707216','43218','16','WrapUp''Wrap Time','Sep 5 2017 5:30PM','agent2','3340','WrapUp' UNION ALL
    SELECT '491','1707216','43218','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:30PM','agent2','3340','InteractionComplete' UNION ALL
    SELECT '492','-1','43237','-1','ExitApplication''Application Close','Sep 5 2017 5:30PM','agent2','3340','ExitApplication' UNION ALL
    SELECT '493','1707218','43220','16','WrapUp''Wrap Time','Sep 5 2017 5:37PM','agent3','3363','WrapUp' UNION ALL
    SELECT '494','1707218','43220','16','InteractionComplete''Interaction Complete','Sep 5 2017 5:37PM','agent3','3363','InteractionComplete' UNION ALL
    SELECT '495','-1','43266','-1','ExitApplication''Application Close','Sep 5 2017 5:37PM','agent3','3363','ExitApplication'
    )

    select *
       --You really only need to calculate the TimeElapsed value below but I am also created the NextStatusTime and NextStatus column
         --so you can get an idea of how the lead function is working:
       ,LEAD(gd.Created, 1, gd.Created) OVER (PARTITION BY gd.AgentID ORDER BY gd.Created) as NextStatusTime
       ,LEAD(gd.[Status], 1, gd.[Status]) OVER (PARTITION BY gd.AgentID ORDER BY gd.Created) as NextStatus
         ,cast(datediff(ss,Created,LEAD(gd.Created, 1, gd.Created) OVER (PARTITION BY gd.AgentID ORDER BY gd.Created)) as INT) as TimeElapsed
    from GarbageData gd

    --order by here is not neccessary...just so you can easily see the data by Agent and Time
    order by AgentID, Created

Viewing 9 posts - 16 through 23 (of 23 total)

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