Results 1 to 4 of 4

Thread: SQL query required for calculating Year to date

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    2

    SQL query required for calculating Year to date

    I need help with writing the sql script to calculate the year to date fields for ta table of periodic data as shown below;


    MeasureName Location Period Actual Budget Year to date(Actual) Year to date(Budget)
    Novels ***** 2007/03 2,536 25,897 2,536 25,897
    Medical Books ***** 2007/03 1,478 2,589 1,478 2,589
    Science Books ***** 2007/03 4,887 369 4,887 369
    Sociology Books ***** 2007/03 1,578 35,897 1,578 35,897
    Liberal Arts Books ***** 2007/03 2,564 25,687 2,564 25,687
    Novels ***** 2007/04 2,536 25,897 5,072 51,794
    Medical Books ***** 2007/04 1,478 2,589 2,956 5,178
    Science Books ***** 2007/04 4,887 369 9,774 738
    Sociology Books ***** 2007/04 1,578 35,897 3,156 71,794
    Liberal Arts Books ***** 2007/04 2,564 25,687 5,128 51,374
    Novels ***** 2007/05 2,536 25,897 7,608 77,691
    Medical Books ***** 2007/05 1,478 2,589 4,434 7,767
    Science Books ***** 2007/05 4,887 369 14,661 1,107
    Sociology Books ***** 2007/05 1,578 35,897 4,734 107,691
    Liberal Arts Books ***** 2007/05 2,564 25,687 7,692 77,061

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: SQL query required for calculating Year to date

    You need to be bit more clearer about what you want ie table schema, database engine (MS SQL, MySQL, Access, etc.)
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  3. #3

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    2

    Re: SQL query required for calculating Year to date

    Hi Mark Gambo,

    The database is actually Oracle.

    Thanks

  4. #4
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: SQL query required for calculating Year to date

    What Mark meant was we'd need to see the table structure and field syou are working with.
    The Sql statement you have come up with and what you are trying to get out of the data...

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width