Hi All,
I am little new for writing this TSQL query.
Can someone please help me here. I would really appreciate.
I have 2 tables here
1.
table name: Budget
column: Budget ID, periodstart,periodend,TotalbudAmount,AmountPO,AmountRemaining
2.
Table Name : POtable
column : POID,BudgetID,AmountApplied,Dateapplied
I want to write a query in such a way that the data is displayed on months basis, so basically I want to divide TotalBudAmount by 12 months(jan till dec) .
Also using second table I want to calculate how much amount is Available;
Formula: AmountAvailJan =TotalBudAmount /12- AmountApplied (from jan if any)
Example of how I want to display data in table
BudgetID PeriodStart Periodend AmountJan AmountAvailJan AmountFeb AmountAvailFeb AmountMar AmountAvailMar........AmountDec AmountAvailDec
Please help.
Regards