I am joining some three tables and getting the following values
week_num provision difference
1 34234
2 4583
i need to find the difference between the provision for week_num2-provision for week_num1 similarly provision for week_num1-provision for week_num52 of last year.
Since i have given condition to bring only 2012 data i donno how to bring the 2011 last week data into this table and find the difference.
can anyone please help me with this ?
You need to use the DATEDIFF function to compute the difference between dates in SQL Server: http://msdn.microsoft.com/en-us/library/ms189794.aspx.
It would help if you could provide a simplified schema in order to guide you to the actual query you need.