• dost ind (3/29/2014)


    I want to write rolling 12 SQL query with following data , input will be FY and period no ie @FY=14, @P=3

    my result should show rolling 12 months only from FY 14 3,2,1 months from year 13 - 12,11,10,9,8,7,6,5,4

    how to do this .group by Dept and objsub. please help

    FYObjSubDeptP_01P_02P_03P_04P_05P_06P_07P_08P_09P_10P_11P_12

    131234511214788785555555555

    13123495455454555555577777777777111

    141234515555555555555588889818

    1412349545555555146744447778888221365488

    Insufficient information provided to really be of any help.

    Please post the DDL (CREATE TABLE statement(s)) for the table(s) involved in the query, sample data for the table(s) as a series of INSERT INTO statements (please note that some people that may try to help may still only have SQL Server 2005), and expected results based on the sample data. The sample data should have values that will be included and excluded from the desired results.

    Need help with this? Please read the first article I reference below in my signature block.