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
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.)
Re: SQL query required for calculating Year to date
Hi Mark Gambo,
The database is actually Oracle.
Thanks
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...