• I didn't get too far because the code block that loads the data generate a syntax error I can't seem to get past.

    insert into Emp_Details (Emp_Name, Company, Join_Date, Resigned_Date)

    values ('John', 'Software', '20060101', '20061231')

    ,('John', 'Software', '20060101', '20061231')

    ,('John', 'SuperSoft', '20070101', '20071231')

    ,('John', 'UltraSoft', '20070201', '20080131')

    ...

    generates:

    Msg 102, Level 15, State 1, Line 3

    Incorrect syntax near ','.

    This on SQL 2005 SP3. Either this only works on 2008, or there is some environment condition assumed by the author that isn't the default.

    Ok, loaded the data by an alternate method, then the RowNumber instance at the end of the order by line also scores a syntax error. Cut and paste isn't that difficult. Is there something else I'm missing?

    I'm trying to apply this to a situation where I need the first duplicate record, but I need to return the name and address, while partitioning only on the address. (the duplicated part). If I considered the name too, of course the records are different, but I don't want to mail twice (or more) to the same address.