Home Forums SQL Server 2012 SQL 2012 - General Query to Dynamically Sum Sales Amounts By Month, Quarter, or Year RE: Query to Dynamically Sum Sales Amounts By Month, Quarter, or Year

  • Now you can add additional Hierarchies, without changing the code ...

    INSERT INTO tblMonths ( MonthKey, Name, ParentKey )

    Values (19, 'OddMonths', 1)

    , (20, 'EvenMonths', 1)

    , ( 6, 'Jan', 19)

    , ( 7, 'Feb', 20)

    , ( 8, 'Mar', 19)

    , ( 9, 'Apr', 20)

    , (10, 'May', 19)

    , (11, 'Jun', 20)

    , (12, 'Jul', 19)

    , (13, 'Aug', 20)

    , (15, 'Sep', 19)

    , (16, 'Oct', 20)

    , (17, 'Nov', 19)

    , (18, 'Dec', 20);