Using SSIS to complete table rows

  • Hi all

    I'm working to fix an issue with a cumulative calculation in a SSIS package and the problem is something like

    Date. Shop type. Products

    Jan. bakery. Cake1

    Jan. bakery. Cake2

    Feb. bakery. Cake1

    Feb Bakery. Cake3

    Mac. Grocery. Grocery1

    What is the best way in SSIS to return a complete all possible combination of result set like

    Date. Shop type. Products

    Jan. bakery. Cake1

    Jan. bakery. Cake2

    Jan. bakery. Cake3

    Jan. grocery. Grocery1

    Feb. bakery. Cake1

    Feb. bakery. Cake2

    Feb Bakery. Cake3

    Feb. grocery. Grocery1

    Mac. Bakery Cake1

    Mac. Bakery. Cake2

    Mac. Bakery. Cake3

    Mac. Grocery. Grocery1

  • I'm not sure how your SSIS package is set up, but you can get that with a query using CROSS JOIN:

    SELECT *

    FROM (

    SELECT DISTINCT Date

    FROM MyTable ) a

    CROSS JOIN (

    SELECT DISTINCT ShopType, Products

    FROM MyTable ) b

    This will give you the Cartesian product of the distinct values.

    Hope that helps!

    Cat

Viewing 2 posts - 1 through 1 (of 1 total)

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