• if object_id('tempdb..#t1') is not null

    drop table #t1

    create table #t1 (SKU# char(5), [Description] varchar(200), SalesDate datetime)

    Insert into #t1 ([SKU#], [Description], SalesDate) Values('01110', 'Red Car with stripe', '01/19/2009')

    Insert into #t1 ([SKU#], [Description], SalesDate) Values('01110', 'Red Car with line', '02/01/2009')

    Insert into #t1 ([SKU#], [Description], SalesDate) Values('01110', 'Red Car with laser', '02/25/2009')

    Insert into #t1 ([SKU#], [Description], SalesDate) Values('01120', 'Blue Car with stripe', '01/19/2009')

    Insert into #t1 ([SKU#], [Description], SalesDate) Values('01120', 'Blue Car with line', '02/05/2009')

    Insert into #t1 ([SKU#], [Description], SalesDate) Values('01120', 'Blue Car with laser', '02/20/2009')

    ;with cte

    AS

    (SELECT *, row_number() over(partition by [sku#] order by SalesDate desc) rn

    from #t1

    )

    select [SKU#], [Description], SalesDate

    from cte

    where rn =1


    * Noel