• Not sure but perhaps this is a simpler approach?

    CREATE TABLE #tTable(

    sk int NOT NULL IDENTITY UNIQUE CLUSTERED,

    CID INT,

    CDate DATETIME,

    Dept VARCHAR(10)

    );

    INSERT INTO #tTable(CID, CDate, Dept)

    VALUES

    (111,'2012-10-05 00:00:00.000','A'),

    (111,'2012-10-18 00:00:00.000','C'),

    (111,'2012-11-01 00:00:00.000','B'),

    (111,'2012-11-01 00:00:00.000','C'),

    (111,'2012-11-20 00:00:00.000','C'),

    (111,'2012-12-09 00:00:00.000','C'),

    (111,'2012-12-11 00:00:00.000','A'),

    (111,'2013-02-21 00:00:00.000','B'),

    (111,'2013-03-22 00:00:00.000','B'),

    (111, '2013-03-22 00:00:00.000','C'),

    (111,'2013-04-12 00:00:00.000','C'),

    (111,'2013-04-26 00:00:00.000','B'),

    (111,'2013-04-26 00:00:00.000','C'),

    (222,'2012-02-13 00:00:00.000','C'),

    (222,'2012-03-02 00:00:00.000','B'),

    (222, '2012-06-16 00:00:00.000','C'),

    (222,'2012-07-12 00:00:00.000','C'),

    (222,'2013-04-26 00:00:00.000','B'),

    (222, '2013-05-23 00:00:00.000','C'),

    (222,'2013-07-11 00:00:00.000','C'),

    (222,'2013-09-19 00:00:00.000','C'),

    (222,'2013-09-20 00:00:00.000','A'),

    (444, '2013-01-14 00:00:00.000','C'),

    (444,'2013-02-14 00:00:00.000','C'),

    (444,'2013-03-14 00:00:00.000','B'),

    (444,'2013-04-14 00:00:00.000','C'),

    (444,'2013-05-14 00:00:00.000','C');

    WITH GroupedRows AS (

    SELECT CID, Dept, sk=1+MIN(sk)

    FROM (

    SELECT sk, CID, CDate, Dept

    ,rn=sk-ROW_NUMBER() OVER (PARTITION BY CID, Dept ORDER BY cDATE)

    FROM #tTable

    WHERE Dept = 'C'

    ) a

    GROUP BY CID, Dept, rn

    HAVING MIN(sk) <> MAX(sk))

    SELECT a.sk, a.CID, a.cDate, a.Dept

    FROM #tTable a

    JOIN GroupedRows b ON a.sk=b.sk;

    GO

    DROP TABLE #tTable;

    Edit: Adding my results:

    sk CID cDate Dept

    5 111 2012-11-20 00:00:00.000 C

    11 111 2013-04-12 00:00:00.000 C

    17 222 2012-07-12 00:00:00.000 C

    20 222 2013-07-11 00:00:00.000 C

    24 444 2013-02-14 00:00:00.000 C

    27 444 2013-05-14 00:00:00.000 C


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    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?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St