Home Forums SQL Server 2008 T-SQL (SS2K8) Recursive cross join to get all available combinaisons RE: Recursive cross join to get all available combinaisons

  • Ninja's_RGR'us (4/8/2010)


    Garadin (4/8/2010)


    Ninja's_RGR'us (4/8/2010)


    Garadin (4/8/2010)


    Chris Morris-439714 (4/8/2010)


    Ninja (Remi?)

    Sympathies mate. How much leeway do you have with the db? Can you for instance sneak in a trigger here and there, and maybe a link table?

    It's an interesting challenge as you and others have pointed out, so I'm fiddling with a recursive CTE to see if it can do anything useful.

    The problem I kept running into with the recursive CTE is the 'missing in the middle' number. Sequences for combos up to 4 combos aren't a problem, once you hit 5 and can have to generate stuff like '02,05' '02,03,05' etc, it falls apart.

    Although, in typing that I might have just thought of way to fix that problem. Keyword being "might" =).

    Be sure to let us know!

    Probably still a few hours work making it all come together. If I get a chance to mess with it again and get anything to work, I'll post it here. Let me know what you decide on compiling this into a T-SQL Challenge (for either simple talk or beyondrelational), as I'll probably submit something similar if you decide not to.

    I'd love to but like eveerybody else I'm really pressed for time. I could easily work 100 hours/week right now just to barely keep up with the current client demands I have... and I'm moving into a new house of top of that so let's say april is quite booked fo rme right now. 😀

    I hear ya. I'd love nothing more than to tear back into this right now just to see if I can figure out a way to do it... I just don't have the time currently :ermm:

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]