SELECT from Many-to-Many Columns Unique Values from Column 1 and Non-duplicate from Column2

  • Thanks for your prompt response.

    I would like to provide more details to the requirements.

    In my challenge, 1 product can has thousands of alerts and I need to report all Alert_Codes and select for each alert a product_code that hasn't been reported in previous alert

    The idea is that all alert_codes should appear once A,B,C...ZZZZZ. For each alert_code I should display 1 of the infinite product_code numbers associated to the alert_code, the only condition is that they do not repeat in the display. The situation is that many of the product_code are repeated in every alert_code and not able to select not repeated. I am trying not to use CURSORS, which would solve the challenge.

    So, the final output should be something like

    A->123

    B->456

    C->789

    D->135

    E->246

    .

    .

    AA->999

    AZ->9999

    .

    .

    ZZZZZ->9999999

    etc...

    The alert_code is an integer in my real scenario, but I just decided to use letters to make simpler.

    The product_code is an integer in my real scenario, I just used 3 digits to make it simpler and easy to differentiate.

    I hope my requirements are better explained.

    Thanks for your help.

  • Thanks for your prompt response.

    I would like to provide more details to the requirements.

    In my challenge, 1 product can has thousands of alerts and I need to report all Alert_Codes and select for each alert a product_code that hasn't been reported in previous alert

    The idea is that all alert_codes should appear once A,B,C...ZZZZZ. For each alert_code I should display 1 of the infinite product_code numbers associated to the alert_code, the only condition is that they do not repeat in the display. The situation is that many of the product_code are repeated in every alert_code and not able to select not repeated. I am trying not to use CURSORS, which would solve the challenge.

    So, the final output should be something like

    A->123

    B->456

    C->789

    D->135

    E->246

    .

    .

    AA->999

    AZ->9999

    .

    .

    ZZZZZ->9999999

    etc...

    The alert_code is an integer in my real scenario, but I just decided to use letters to make simpler.

    The product_code is an integer in my real scenario, I just used 3 digits to make it simpler and easy to differentiate.

    I hope my requirements are better explained.

    Thanks for your help.

  • Thanks for the help.

Viewing 3 posts - 16 through 17 (of 17 total)

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