• I would do it using a user defined function. Some / Many may not consider this a SET based approach.

    PLEASE NOTE this example creates a permanat table and user defined function

    Create Table tTestData

    (

    StaffName varchar(40),

    ReviewDate smalldatetime

    )

    Insert Into tTestData(StaffName, ReviewDate)

    Select 'Blow, Joe','2008-01-24' Union All

    Select 'Doe, Jane','2008-01-22' Union All

    Select 'Dunno, I', '2007-07-05' Union All

    Select 'Blow, Joe','2007-06-28' Union All

    Select 'Doe, Jane','2007-06-11' Union All

    Select 'Blow, Joe','2007-03-13' Union All

    Select 'Blow, Joe','2007-12-21' Union All

    Select 'Doe, Jane','2007-12-16' Union All

    Select 'Doe, Jane','2007-03-12' Union All

    Select 'Dunno, I', '2007-12-18' Union All

    Select 'Blow, Joe','2006-03-23' Union All

    Select 'Blow, Joe','2006-07-18' Union All

    Select 'Doe, Jane','2006-05-16' Union All

    Select 'Doe, Jane','2006-11-19' Union All

    Select 'Dunno, I', '2006-12-10'

    GO

    CREATE FUNCTION dbo.udf_GetDates

    (

    @pStaffName VARCHAR(40),

    @pReviewDate DATETIME

    )

    RETURNS VARCHAR(2000)

    AS

    BEGIN

    DECLARE @RDates VARCHAR(2000)

    SELECT @RDates = COALESCE(@RDates + ', ', '') + CONVERT(VARCHAR, ReviewDate, 101)

    FROM

    tTestData

    WHERE

    StaffName = @pStaffName

    ANDDATEDIFF(YEAR, ReviewDate, @pReviewDate) = 0

    RETURN @RDates

    END

    GO

    SELECTStaffName,

    [2006 Reviews] = dbo.udf_GetDates(StaffName, '01/01/2006'),

    [2007 Reviews] = dbo.udf_GetDates(StaffName, '01/01/2007'),

    [2008 Reviews] = dbo.udf_GetDates(StaffName, '01/01/2008')

    FROM

    (

    Select DISTINCT StaffName

    From

    tTestData

    ) A

    GO

    DROP TABLE tTestData

    DROP FUNCTION udf_GetDates

    Regards,
    gova