Generating Combination Numbers

  • Hi friends,

    I have a scenario where the table values are

    ID First Second

    162

    142

    122

    261

    241

    221

    From this table I want to generate a combination where Next ID values is max(previous ID) ie 3 and a combination of first and second which didnt come in the Previous combination, for eg

    3 6 2

    3 4 1

    3 2 2

    Can any solve this issue...help appreciated...

  • varunfilim (7/29/2010)


    Hi friends,

    I have a scenario where the table values are

    ID First Second

    162

    142

    122

    261

    241

    221

    From this table I want to generate a combination where Next ID values is max(previous ID) ie 3 and a combination of first and second which didnt come in the Previous combination, for eg

    3 6 2

    3 4 1

    3 2 2

    Can any solve this issue...help appreciated...

    Umm, why not: -

    3 6 2

    3 4 2

    3 2 2

    ??

    Just want to understand the actual requirement before I spend some time.


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • This was removed by the editor as SPAM

  • Hi,

    I Have similar requirement. If anyone solve this, pls let me know. Explanation of the problem.

    Consider i have two columns with combinations of numbers. I want to pick the genuine combinations of numbers which doesnt involve in other valid conbinations. For ex.,

    Num1 Num2

    6 2

    2 1

    2 3

    4 6

    3 1

    8 9

    3 9

    6 8

    My result should be

    6 2

    3 1

    8 9

    Can this be done without using loops...

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply