• First, please pay attention to how I setup the test data. This is something you should do for us. I found it easier for this solution to use a table variable. You could use a temp table (#TestData for instance) or a permanent table (dbo.TestData for another example).

    Second, notice when I wrote the insert statement for the test data I used the ISO standard yyyy-mm-dd for the dates. I also could have used yyyymmdd. Both of these are preferable as everyone should recognize this format.

    Here is my shot at a solution:

    /*

    -- Format of dates is not stated based on anticipated results posted later

    -- making the assumption that the following dates are in dd/mm/yyyy format.

    Date method

    01/05/2013 A

    01/05/2013 B

    01/05/2013 C

    01/05/2013 D

    02/05/2013 A

    02/05/2013 B

    02/05/2013 C

    02/05/2013 D

    03/05/2013 A

    03/05/2013 B

    03/05/2013 C

    03/05/2013 D

    07/08/2014 A

    07/08/2014 B

    05/09/2014 A

    05/09/2014 B

    */

    declare @TestData table (

    MethodDate date,

    Method char(1)

    );

    insert into @TestData

    values ('2013-05-01','A'),

    ('2013-05-01','B'),

    ('2013-05-01','C'),

    ('2013-05-01','D'),

    ('2013-05-02','A'),

    ('2013-05-02','B'),

    ('2013-05-02','C'),

    ('2013-05-02','B'),

    ('2013-05-03','A'),

    ('2013-05-03','B'),

    ('2013-05-03','C'),

    ('2013-05-03','D'),

    ('2013-08-07','A'),

    ('2013-08-07','B'),

    ('2013-09-05','A'),

    ('2013-09-05','B');

    select

    td.MethodDate,

    td.Method

    from

    @TestData td

    cross apply (select max(MethodDate) MethodDate, Method from @TestData where Method = 'B' group by Method) ca

    where

    (td.Method = ca.Method and td.MethodDate = ca.MethodDate) or

    (td.Method = 'A' and td.MethodDate < ca.MethodDate);