Home Forums SQL Server 2012 SQL Server 2012 - T-SQL Get data from Previous record (Cumulative Data)-- Urgent help required RE: Get data from Previous record (Cumulative Data)-- Urgent help required

  • Excellent job posting ddl and sample data. I am a little uncertain what you want for output. In your original post this is what you had for PRJ_ID 1

    The output i want is

    Date, Prj_ID, Amount

    Jan12, 1, 1000

    Feb12, 1, 1500

    Mar12, 1, 1500

    Apr12, 1 , 1800

    May12, 1, 1800

    Jun12 , 1 , 1800

    July12, 1 , 1200

    Au12 , 1 , 1200

    Sep12, 1 , 1200

    Is the data supposed to split by month? What defines the start and end months? In your example here you go to September but the data ends in July.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/