• Hi Sean,

    Here are the DDL and sample data.

    Thanks a lot for spending your time on it

    CREATE TABLE #temp

    (set_id INT

    ,product CHAR(5)

    ,attribute INT)

    --insert set 1

    INSERT INTO #temp

    (set_id, product, attribute)

    VALUES

    (1,'A',10)

    ,(1,'A',11)

    --insert set 2

    INSERT INTO #temp

    (set_id, product, attribute)

    VALUES

    (2,'A',10)

    ,(2,'A',12)

    --insert set 2

    INSERT INTO #temp

    (set_id, product, attribute)

    VALUES

    (3,'A',10)

    ,(3,'A',11)

    DROP TABLE #temp