• Sean Lange (8/19/2013)


    Walton (8/19/2013)


    Hi all,

    I need a help on getting the distinct set.

    My Data look like this:

    SET 1

    SET ID Product Attribute

    1 A 10

    1 A 11

    SET 2

    SET ID Product Attribute

    2 A 10

    2 A 12

    SET 3

    SET ID Product Attribute

    3 A 10

    3 A 11

    Since set ID 1 and 3 has the same product and attribute I just need to get distinct set having the same product and attribute. The result set will look like this

    SET ID Product Attribute

    1 A 10

    1 A 11

    2 A 10

    2 A 12

    Thank you all in advance for your help.

    So what happens to Set 3? The product/attribute combination is both Set 1 and 3 but how to decide which Set to use?

    Maybe as simple as using MIN?

    You didn't provide anything usable so my code probably doesn't work as is.

    select min(setid), Product, Attribute

    From SomeTable

    group by Product, Attribute

    Hi Sean,

    I do not care if I am getting set 1 or set 3 either one would be fine. But the result set should return the complete list for the set. The result set should look like this :

    SET ID Product Attribute

    1 A 10

    1 A 11

    2 A 10

    2 A 12

    But with the solution you provided, result will like this:

    SET_ID Product Attribute

    1 A 10

    1 A 11

    2 A 12

    Thanks for looking onto it.

    Thanks