• avssrk (9/20/2012)


    In Table A , Any number of Classes can be Grouped to a Group

    In Table A , Same set of Classes Cannot be Grouped

    In Table B I would like say the any Number of Products can grouped a class ( min 1)

    * if my Table A Product id is part of Configured Classes That Rule Set ( Item Group in Tablec not be Generated )

    Furhter ,I will Copy the Generated matrix to simaler result Set table. When user changes in existing configration and trigger the Regeneration .

    My the old item Group Id should be retained (based on old configration ) and increamental group to be generated.

    I have attached the source and and output.. here

    I would be happy to try help you but you'll need to set up your new source data in the following format because I see that it has changed.

    DECLARE @ClassID TABLE (Class INT, ID INT)

    DECLARE @ProductClass TABLE(Product INT, Class INT)

    INSERT INTO @ClassID

    SELECT 1654, 1

    UNION ALL SELECT 1655, 1

    INSERT INTO @ProductClass

    SELECT 538, 1654

    UNION ALL SELECT 539, 1654

    UNION ALL SELECT 540, 1655

    UNION ALL SELECT 541, 1655

    I'll check back this weekend and see if you've done that then try to understand what the currently stated requirements are saying.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St