• Isn't that more a scenario for CROSS JOINS rather than a recursive cte?

    I would use a Tally table to expand the number of coins per denomination and the CROSS JOIN to get the total amount.

    But with the 5000 coins per denomination and 8 denomiations this would require "quite some data space" since we're talking about

    390.625.000.000.000.000.000.000.000.000 possible solutions (including duplicates).

    Just with 5 coins per denomination we already have 390625 possible solutions (5*5*5*5*5*5*5*5 = 5^8). Or am I missing something?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]